Skip to content

Commit

Permalink
chore: make all constable fn to const fn.
Browse files Browse the repository at this point in the history
Signed-off-by: Yu Li <[email protected]>
  • Loading branch information
yukiiiteru committed Nov 8, 2024
1 parent 2a546a4 commit 6cdd64c
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion motore/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "motore"
version = "0.4.1"
version = "0.4.2"
edition = "2021"
description = """
Motore is a library of modular and reusable components for building robust
Expand Down
2 changes: 1 addition & 1 deletion motore/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl Default for ServiceBuilder<Identity> {

impl ServiceBuilder<Identity> {
/// Create a new [`ServiceBuilder`].
pub fn new() -> Self {
pub const fn new() -> Self {
ServiceBuilder {
layer: Identity::new(),
}
Expand Down
2 changes: 1 addition & 1 deletion motore/src/layer/ext/map_err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub struct MapErrLayer<F> {
}

impl<F> MapErrLayer<F> {
pub fn new(f: F) -> Self {
pub const fn new(f: F) -> Self {
MapErrLayer { f }
}
}
Expand Down
2 changes: 1 addition & 1 deletion motore/src/layer/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub struct Identity {

impl Identity {
/// Create a new `Identity` value
pub fn new() -> Identity {
pub const fn new() -> Identity {
Identity { _p: () }
}
}
Expand Down
2 changes: 1 addition & 1 deletion motore/src/layer/layer_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ use super::Layer;
/// let wrapped_service = log_layer.layer(uppercase_service);
/// ```
/// [`Service`]: crate::Service
pub fn layer_fn<F>(f: F) -> LayerFn<F> {
pub const fn layer_fn<F>(f: F) -> LayerFn<F> {
LayerFn { f }
}

Expand Down
2 changes: 1 addition & 1 deletion motore/src/layer/layers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ impl Default for Layers<Identity> {
}

impl<L> Layers<L> {
pub fn new(layer: L) -> Self {
pub const fn new(layer: L) -> Self {
Layers(layer)
}

Expand Down
2 changes: 1 addition & 1 deletion motore/src/layer/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct Stack<Inner, Outer> {

impl<Inner, Outer> Stack<Inner, Outer> {
/// Create a new `Stack`.
pub fn new(inner: Inner, outer: Outer) -> Self {
pub const fn new(inner: Inner, outer: Outer) -> Self {
Stack { inner, outer }
}
}
Expand Down
2 changes: 1 addition & 1 deletion motore/src/layer/tower_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct TowerAdapterLayer<F, Cx, MotoreReq> {
}

impl<F, Cx, MotoreReq> TowerAdapterLayer<F, Cx, MotoreReq> {
pub fn new(f: F) -> Self {
pub const fn new(f: F) -> Self {
Self {
f,
_phantom: PhantomData,
Expand Down
4 changes: 2 additions & 2 deletions motore/src/service/tower_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub struct Tower<S, F, Cx, MotoreReq> {
}

impl<S, F, Cx, MotoreReq> Tower<S, F, Cx, MotoreReq> {
pub fn new(inner: S, f: F) -> Self {
pub const fn new(inner: S, f: F) -> Self {
Self {
inner,
f,
Expand Down Expand Up @@ -162,7 +162,7 @@ pub struct Motore<S, F> {
}

impl<S, F> Motore<S, F> {
pub fn new(inner: S, f: F) -> Self {
pub const fn new(inner: S, f: F) -> Self {
Self { inner, f }
}
}
Expand Down
4 changes: 2 additions & 2 deletions motore/src/timeout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub struct Timeout<S> {
}

impl<S> Timeout<S> {
pub fn new(inner: S, duration: Option<Duration>) -> Self {
pub const fn new(inner: S, duration: Option<Duration>) -> Self {
Self { inner, duration }
}
}
Expand Down Expand Up @@ -51,7 +51,7 @@ pub struct TimeoutLayer {
}

impl TimeoutLayer {
pub fn new(duration: Option<Duration>) -> Self {
pub const fn new(duration: Option<Duration>) -> Self {
TimeoutLayer { duration }
}
}
Expand Down

0 comments on commit 6cdd64c

Please sign in to comment.