Skip to content

Commit

Permalink
Remove embassy-sleep as default sleeper, minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wackazong committed Dec 23, 2024
1 parent ad7d2c3 commit e4b7ac5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
7 changes: 1 addition & 6 deletions backon/src/blocking_sleep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ pub type DefaultBlockingSleeper = PleaseEnableAFeatureOrProvideACustomSleeper;
/// it uses [`std::thread::sleep`].
#[cfg(feature = "std-blocking-sleep")]
pub type DefaultBlockingSleeper = StdSleeper;
/// The default implementation of `Sleeper` while feature `embassy-sleep` enabled.
///
/// it uses [`embassy_time::block_for`].
#[cfg(all(not(feature = "std-blocking-sleep"), feature = "embassy-sleep"))]
pub type DefaultBlockingSleeper = EmbassySleeper;

/// A placeholder type that does not implement [`Sleeper`] and will therefore fail to compile if used as one.
///
Expand All @@ -59,7 +54,7 @@ impl BlockingSleeper for StdSleeper {
}
}

/// The no_std implementation of `StdSleeper`.
/// A no_std blocking sleeper
#[cfg(feature = "embassy-sleep")]
#[derive(Clone, Copy, Debug, Default)]
pub struct EmbassySleeper;
Expand Down
13 changes: 4 additions & 9 deletions backon/src/sleep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ pub type DefaultSleeper = TokioSleeper;
/// It uses `gloo_timers::sleep::sleep`.
#[cfg(all(target_arch = "wasm32", feature = "gloo-timers-sleep"))]
pub type DefaultSleeper = GlooTimersSleep;
/// The default implementation of `Sleeper` while feature `embassy-sleep` enabled.
///
/// It uses `embassy_time::Timer`.
#[cfg(all(not(feature = "std"), feature = "embassy-sleep"))]
pub type DefaultSleeper = EmbassySleep;

/// A placeholder type that does not implement [`Sleeper`] and will therefore fail to compile if used as one.
///
Expand Down Expand Up @@ -101,12 +96,12 @@ impl Sleeper for GlooTimersSleep {
}
}

/// The default implementation of `Sleeper` utilizes `embassy-time::Timer`.
#[cfg(all(not(feature = "std"), feature = "embassy-sleep"))]
/// The embassy-sleep implementation of `Sleeper` utilizes `embassy-time::Timer`.
#[cfg(feature = "embassy-sleep")]
#[derive(Clone, Copy, Debug, Default)]
pub struct EmbassySleep;
pub struct EmbassySleeper;

#[cfg(all(not(feature = "std"), feature = "embassy-sleep"))]
#[cfg(feature = "embassy-sleep")]
impl Sleeper for EmbassySleep {
type Sleep = embassy_time::Timer;

Expand Down

0 comments on commit e4b7ac5

Please sign in to comment.