pub trait PkInstantwhere
Self: Sized,{
// Required methods
fn now() -> Self;
fn elapsed(&self) -> Duration;
}Expand description
Trait representing an instant in time.
This trait abstracts over the std::time::Instant to support no_std environments
where a custom timer implementation might be needed. In std environments, using std::time::Instant is recommended.
§Note
If you want to provide a custom implementation to be used in PkCommand, besides implementing this trait,
you also need to ensure that Add<Duration, Output = Instant>, PartialOrd, and Copy are implemented for your type.
§Tips
If you are using Embassy on your embedded device, you can use the provided EmbassyInstant adapter, which wraps embassy_time::Instant and implements the necessary traits for compatibility with PkCommand.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Implementors§
impl PkInstant for EmbassyInstant
embassy-time only.