Struct Time
pub struct Time;
Expand description
Implements the TimeAbstraction
trait for embassy.
§Details
- Before using
Self::duration_since_epoch
, you are expected to synchronize system time viaSelf::set_system_time
. - Maximum precision of system time synchronization is limited to seconds.
Trait Implementations§
§impl SystemTime for Time
impl SystemTime for Time
§fn duration_since_epoch() -> Result<Duration, SystemTimeError>
fn duration_since_epoch() -> Result<Duration, SystemTimeError>
§impl SystemTimeSync for Time
impl SystemTimeSync for Time
§fn set_system_time(
duration_since_epoch: Duration,
) -> Result<(), SystemTimeError>
fn set_system_time( duration_since_epoch: Duration, ) -> Result<(), SystemTimeError>
Updates the current system time. Read more
§impl TimeAbstraction for Time
impl TimeAbstraction for Time
§async fn sleep_until(deadline: Instant) -> Result<(), Error>
async fn sleep_until(deadline: Instant) -> Result<(), Error>
Returns a future that resolves successfully at the specified
deadline
(or earlier with an error).§async fn sleep(duration: Duration) -> Result<(), Error>
async fn sleep(duration: Duration) -> Result<(), Error>
Returns a future that resolves successfully after the specified
duration
(or earlier with an error). Read moreSource§async fn timeout_at<F>(
deadline: Instant,
future: F,
) -> Result<<F as IntoFuture>::Output, Either<Exceeded, Error>>where
Self: Sized,
F: IntoFuture,
async fn timeout_at<F>(
deadline: Instant,
future: F,
) -> Result<<F as IntoFuture>::Output, Either<Exceeded, Error>>where
Self: Sized,
F: IntoFuture,
Returns a future that will resolve when: the wrapped future resolves, the
deadline
is reached, or there is an
error.Auto Trait Implementations§
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more