pub struct CuInstant(/* private fields */);Expand description
An instant on one robot clock’s undisciplined local timeline, in nanoseconds.
Obtain readings through RobotClock::raw_now. Compare instants only within
that clock and its clones, which share an origin and counter calibration.
Execution timestamps use CuTime; converting an instant to execution time
requires the clock’s mapping.
use cu29_clock::{CuDuration, RobotClock};
let (clock, control) = RobotClock::mock();
let start = clock.raw_now();
control.increment(CuDuration::from_millis(1));
let deadline = start + CuDuration::from_millis(1);
assert_eq!(clock.raw_now(), deadline);
assert_eq!(deadline - start, CuDuration::from_millis(1));Implementations§
Trait Implementations§
Source§impl Add<CuDuration> for CuInstant
impl Add<CuDuration> for CuInstant
Source§impl<'de, Context> BorrowDecode<'de, Context> for CuInstant
impl<'de, Context> BorrowDecode<'de, Context> for CuInstant
Source§fn borrow_decode<D: BorrowDecoder<'de>>(
decoder: &mut D,
) -> Result<Self, DecodeError>
fn borrow_decode<D: BorrowDecoder<'de>>( decoder: &mut D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
impl Copy for CuInstant
Source§impl<'de> Deserialize<'de> for CuInstant
impl<'de> Deserialize<'de> for CuInstant
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for CuInstant
Source§impl Ord for CuInstant
impl Ord for CuInstant
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for CuInstant
impl PartialOrd for CuInstant
impl StructuralPartialEq for CuInstant
Source§impl Sub<CuDuration> for CuInstant
impl Sub<CuDuration> for CuInstant
Source§impl ValueDecode for CuInstant
impl ValueDecode for CuInstant
Source§const DECODE: &'static ValueDecodeSpec = <u64 as bincode::ValueDecode>::DECODE
const DECODE: &'static ValueDecodeSpec = <u64 as bincode::ValueDecode>::DECODE
Complete wire recipe for this encoding.
Source§const METADATA: &'static [ValueMetadata]
const METADATA: &'static [ValueMetadata]
Static logical metadata retained alongside the wire recipe. Read more
Auto Trait Implementations§
impl Freeze for CuInstant
impl RefUnwindSafe for CuInstant
impl Send for CuInstant
impl Sync for CuInstant
impl Unpin for CuInstant
impl UnsafeUnpin for CuInstant
impl UnwindSafe for CuInstant
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