pub enum Stamp<T = Timestamp>where
T: TimePoint,{
Static,
At(T),
}Expand description
When a transform is valid: at one instant, or for all time.
Stamp is what Transform::timestamp
returns and what its constructors take:
a dynamic sample carries Stamp::At(t), a fixed relationship such as a
sensor mount carries Stamp::Static. Staticness is a separate variant
rather than a reserved timestamp value, so every instant the clock can
produce — including t = 0 on boot-relative clocks — is ordinary
dynamic data.
§Examples
use transforms::time::{Stamp, Timestamp};
let dynamic: Stamp = Stamp::At(Timestamp::zero());
let fixed: Stamp = Stamp::Static;
assert!(!dynamic.is_static());
assert!(fixed.is_static());
assert_eq!(dynamic.at(), Some(Timestamp::zero()));
assert_eq!(fixed.at(), None);Stamp is deliberately not ordered. Static denotes all time rather
than an instant, so it has no position on a time axis; a derived ordering
would place it below every real instant and make the natural
freshest-sample idiom (max_by_key(|tf| tf.timestamp)) rank an eternal
transform as older than the epoch. Order the instants themselves — via
Stamp::at — and decide what static means for the comparison at hand.
With the optional serde feature, Stamp serializes as an explicitly
tagged enum: Stamp::At(t) as {"At": t} and Stamp::Static as
"Static" in JSON, and as a variant index followed by the payload in
non-self-describing formats. No timestamp value is reserved, and neither
an absent nor a null timestamp field decodes — a message that lost
its stamp is an error, never an eternal static transform.
Variants§
Static
Valid for all time: a fixed frame relationship that never expires.
At(T)
Valid at one instant.
Implementations§
Trait Implementations§
impl<T> Copy for Stamp<T>
Source§impl<'de, T> Deserialize<'de> for Stamp<T>where
T: TimePoint + Deserialize<'de>,
Available on crate feature serde only.
impl<'de, T> Deserialize<'de> for Stamp<T>where
T: TimePoint + Deserialize<'de>,
serde only.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>,
impl<T> Eq for Stamp<T>
impl<T> StructuralPartialEq for Stamp<T>
Auto Trait Implementations§
impl<T> Freeze for Stamp<T>where
T: Freeze,
impl<T> RefUnwindSafe for Stamp<T>where
T: RefUnwindSafe,
impl<T> Send for Stamp<T>where
T: Send,
impl<T> Sync for Stamp<T>where
T: Sync,
impl<T> Unpin for Stamp<T>where
T: Unpin,
impl<T> UnsafeUnpin for Stamp<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Stamp<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
key and return true if they are equal.