Skip to content

Commit

Permalink
Make tower-layer no_std compatible.
Browse files Browse the repository at this point in the history
  • Loading branch information
TTWNO committed Jan 25, 2025
1 parent 44fe377 commit 429d1b0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tower-layer/src/identity.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::Layer;
use std::fmt;
use core::fmt;

/// A no-op middleware.
///
Expand Down
10 changes: 5 additions & 5 deletions tower-layer/src/layer_fn.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::Layer;
use std::fmt;
use core::fmt;

/// Returns a new [`LayerFn`] that implements [`Layer`] by calling the
/// given function.
Expand All @@ -13,10 +13,10 @@ use std::fmt;
/// # Example
/// ```rust
/// # use tower::Service;
/// # use std::task::{Poll, Context};
/// # use core::task::{Poll, Context};
/// # use tower_layer::{Layer, layer_fn};
/// # use std::fmt;
/// # use std::convert::Infallible;
/// # use core::fmt;
/// # use core::convert::Infallible;
/// #
/// // A middleware that logs requests before forwarding them to another service
/// pub struct LogService<S> {
Expand Down Expand Up @@ -88,7 +88,7 @@ where
impl<F> fmt::Debug for LayerFn<F> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("LayerFn")
.field("f", &format_args!("{}", std::any::type_name::<F>()))
.field("f", &format_args!("{}", core::any::type_name::<F>()))
.finish()
}
}
Expand Down
6 changes: 4 additions & 2 deletions tower-layer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
//!
//! [`Service`]: https://docs.rs/tower/*/tower/trait.Service.html
#![no_std]

mod identity;
mod layer_fn;
mod stack;
Expand All @@ -41,9 +43,9 @@ pub use self::{
///
/// ```rust
/// # use tower_service::Service;
/// # use std::task::{Poll, Context};
/// # use core::task::{Poll, Context};
/// # use tower_layer::Layer;
/// # use std::fmt;
/// # use core::fmt;
///
/// pub struct LogLayer {
/// target: &'static str,
Expand Down
2 changes: 1 addition & 1 deletion tower-layer/src/stack.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::Layer;
use std::fmt;
use core::fmt;

/// Two middlewares chained together.
#[derive(Clone)]
Expand Down
1 change: 0 additions & 1 deletion tower-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ extern crate std;

use alloc::boxed::Box;


use core::future::Future;
use core::marker::Sized;
use core::result::Result;
Expand Down

0 comments on commit 429d1b0

Please sign in to comment.