pub enum TimestampPrecision {
Microsecond,
Millisecond,
None,
}Expand description
Timestamp precision.
Indicates the precision of timestamps provided by the hardware.
§Examples
use canlink_hal::TimestampPrecision;
let precision = TimestampPrecision::Microsecond;
assert_eq!(precision.resolution_us(), Some(1));Variants§
Microsecond
Microsecond precision (1 µs)
Millisecond
Millisecond precision (1 ms = 1000 µs)
None
No timestamp support
Implementations§
Source§impl TimestampPrecision
impl TimestampPrecision
Sourcepub const fn resolution_us(&self) -> Option<u64>
pub const fn resolution_us(&self) -> Option<u64>
Get the resolution in microseconds.
Returns None if timestamps are not supported.
§Examples
use canlink_hal::TimestampPrecision;
assert_eq!(TimestampPrecision::Microsecond.resolution_us(), Some(1));
assert_eq!(TimestampPrecision::Millisecond.resolution_us(), Some(1000));
assert_eq!(TimestampPrecision::None.resolution_us(), None);Sourcepub const fn is_supported(&self) -> bool
pub const fn is_supported(&self) -> bool
Check if timestamps are supported.
§Examples
use canlink_hal::TimestampPrecision;
assert!(TimestampPrecision::Microsecond.is_supported());
assert!(TimestampPrecision::Millisecond.is_supported());
assert!(!TimestampPrecision::None.is_supported());Trait Implementations§
Source§impl Clone for TimestampPrecision
impl Clone for TimestampPrecision
Source§fn clone(&self) -> TimestampPrecision
fn clone(&self) -> TimestampPrecision
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TimestampPrecision
impl Debug for TimestampPrecision
Source§impl<'de> Deserialize<'de> for TimestampPrecision
impl<'de> Deserialize<'de> for TimestampPrecision
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
Source§impl Hash for TimestampPrecision
impl Hash for TimestampPrecision
Source§impl PartialEq for TimestampPrecision
impl PartialEq for TimestampPrecision
Source§impl Serialize for TimestampPrecision
impl Serialize for TimestampPrecision
impl Copy for TimestampPrecision
impl Eq for TimestampPrecision
impl StructuralPartialEq for TimestampPrecision
Auto Trait Implementations§
impl Freeze for TimestampPrecision
impl RefUnwindSafe for TimestampPrecision
impl Send for TimestampPrecision
impl Sync for TimestampPrecision
impl Unpin for TimestampPrecision
impl UnsafeUnpin for TimestampPrecision
impl UnwindSafe for TimestampPrecision
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.