pub struct Datum<T> {
pub time: Time,
pub value: T,
}Fields§
§time: TimeTimestamp for the datum. This should probably be absolute.
value: TThe thing with the timestamp.
Implementations§
Source§impl<T> Datum<T>
impl<T> Datum<T>
Sourcepub const fn new(time: Time, value: T) -> Datum<T>
pub const fn new(time: Time, value: T) -> Datum<T>
Constructor for Datum type.
Examples found in repository?
More examples
Sourcepub fn replace_if_older_than(&mut self, maybe_replace_with: Self) -> bool
pub fn replace_if_older_than(&mut self, maybe_replace_with: Self) -> bool
Replaces self with maybe_replace_with if maybe_replace_with’s timestamp is newer than
self’s. Returns true if self was replaced and false otherwise.
Trait Implementations§
Source§impl<T: AddAssign> AddAssign<T> for Datum<T>
impl<T: AddAssign> AddAssign<T> for Datum<T>
Source§fn add_assign(&mut self, other: T)
fn add_assign(&mut self, other: T)
Performs the
+= operation. Read moreSource§impl<T: AddAssign> AddAssign for Datum<T>
impl<T: AddAssign> AddAssign for Datum<T>
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+= operation. Read moreSource§impl<T: DivAssign> DivAssign<T> for Datum<T>
impl<T: DivAssign> DivAssign<T> for Datum<T>
Source§fn div_assign(&mut self, other: T)
fn div_assign(&mut self, other: T)
Performs the
/= operation. Read moreSource§impl DivAssign<f32> for Datum<Command>
impl DivAssign<f32> for Datum<Command>
Source§fn div_assign(&mut self, other: f32)
fn div_assign(&mut self, other: f32)
Performs the
/= operation. Read moreSource§impl DivAssign<f32> for Datum<State>
impl DivAssign<f32> for Datum<State>
Source§fn div_assign(&mut self, other: f32)
fn div_assign(&mut self, other: f32)
Performs the
/= operation. Read moreSource§impl<T: DivAssign> DivAssign for Datum<T>
impl<T: DivAssign> DivAssign for Datum<T>
Source§fn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
Performs the
/= operation. Read moreSource§impl<T: MulAssign> MulAssign<T> for Datum<T>
impl<T: MulAssign> MulAssign<T> for Datum<T>
Source§fn mul_assign(&mut self, other: T)
fn mul_assign(&mut self, other: T)
Performs the
*= operation. Read moreSource§impl MulAssign<f32> for Datum<Command>
impl MulAssign<f32> for Datum<Command>
Source§fn mul_assign(&mut self, other: f32)
fn mul_assign(&mut self, other: f32)
Performs the
*= operation. Read moreSource§impl MulAssign<f32> for Datum<State>
impl MulAssign<f32> for Datum<State>
Source§fn mul_assign(&mut self, other: f32)
fn mul_assign(&mut self, other: f32)
Performs the
*= operation. Read moreSource§impl<T: MulAssign> MulAssign for Datum<T>
impl<T: MulAssign> MulAssign for Datum<T>
Source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
Performs the
*= operation. Read moreSource§impl<E: Copy + Debug> Settable<Datum<Command>, E> for Terminal<'_, E>
impl<E: Copy + Debug> Settable<Datum<Command>, E> for Terminal<'_, E>
Source§fn get_settable_data_ref(&self) -> &SettableData<Datum<Command>, E>
fn get_settable_data_ref(&self) -> &SettableData<Datum<Command>, E>
As traits cannot have fields, get functions and separate types are required. All you have to
do is make a field for a corresponding
SettableData, make this return an immutable
reference to it, and make get_settable_data_mut
return a mutable reference to it.Source§fn get_settable_data_mut(&mut self) -> &mut SettableData<Datum<Command>, E>
fn get_settable_data_mut(&mut self) -> &mut SettableData<Datum<Command>, E>
As traits cannot have fields, get functions and separate types are required. All you have to
do is make a field for a corresponding
SettableData, make this return a mutable
reference to it, and make get_settable_data_ref
return an immutable reference to it.Source§fn impl_set(&mut self, _command: Datum<Command>) -> NothingOrError<E>
fn impl_set(&mut self, _command: Datum<Command>) -> NothingOrError<E>
Set something, not updating the internal
SettableData. Due to current limitations of the
language, you must implement this but call set. Do not call this directly as it will make
get_last_request work incorrectly.Source§fn set(&mut self, value: S) -> NothingOrError<E>
fn set(&mut self, value: S) -> NothingOrError<E>
Set something to a value. For example, this could set a motor to a voltage. You should call
this and not
impl_set.Source§fn follow(&mut self, getter: Reference<dyn Getter<S, E>>)
fn follow(&mut self, getter: Reference<dyn Getter<S, E>>)
Begin following a
Getter of the same type. For this to work, you must have
update_following_data in your Updatable implementation.Source§fn stop_following(&mut self)
fn stop_following(&mut self)
Stop following the
Getter.Source§fn update_following_data(&mut self) -> NothingOrError<E>
fn update_following_data(&mut self) -> NothingOrError<E>
Get a new value from the
Getter we’re following, if there is one, and call
set
accordingly. You must add this to your Updatable implementation if you are following
Getters. This is a current limitation of the Rust language. If specialization is ever
stabilized, this will hopefully be done in a better way.Source§fn get_last_request(&self) -> Option<S>
fn get_last_request(&self) -> Option<S>
Get the argument from the last time
set was called.Source§impl<E: Copy + Debug> Settable<Datum<State>, E> for Terminal<'_, E>
impl<E: Copy + Debug> Settable<Datum<State>, E> for Terminal<'_, E>
Source§fn get_settable_data_ref(&self) -> &SettableData<Datum<State>, E>
fn get_settable_data_ref(&self) -> &SettableData<Datum<State>, E>
As traits cannot have fields, get functions and separate types are required. All you have to
do is make a field for a corresponding
SettableData, make this return an immutable
reference to it, and make get_settable_data_mut
return a mutable reference to it.Source§fn get_settable_data_mut(&mut self) -> &mut SettableData<Datum<State>, E>
fn get_settable_data_mut(&mut self) -> &mut SettableData<Datum<State>, E>
As traits cannot have fields, get functions and separate types are required. All you have to
do is make a field for a corresponding
SettableData, make this return a mutable
reference to it, and make get_settable_data_ref
return an immutable reference to it.Source§fn impl_set(&mut self, _state: Datum<State>) -> NothingOrError<E>
fn impl_set(&mut self, _state: Datum<State>) -> NothingOrError<E>
Set something, not updating the internal
SettableData. Due to current limitations of the
language, you must implement this but call set. Do not call this directly as it will make
get_last_request work incorrectly.Source§fn set(&mut self, value: S) -> NothingOrError<E>
fn set(&mut self, value: S) -> NothingOrError<E>
Set something to a value. For example, this could set a motor to a voltage. You should call
this and not
impl_set.Source§fn follow(&mut self, getter: Reference<dyn Getter<S, E>>)
fn follow(&mut self, getter: Reference<dyn Getter<S, E>>)
Begin following a
Getter of the same type. For this to work, you must have
update_following_data in your Updatable implementation.Source§fn stop_following(&mut self)
fn stop_following(&mut self)
Stop following the
Getter.Source§fn update_following_data(&mut self) -> NothingOrError<E>
fn update_following_data(&mut self) -> NothingOrError<E>
Get a new value from the
Getter we’re following, if there is one, and call
set
accordingly. You must add this to your Updatable implementation if you are following
Getters. This is a current limitation of the Rust language. If specialization is ever
stabilized, this will hopefully be done in a better way.Source§fn get_last_request(&self) -> Option<S>
fn get_last_request(&self) -> Option<S>
Get the argument from the last time
set was called.Source§impl<T: SubAssign> SubAssign<T> for Datum<T>
impl<T: SubAssign> SubAssign<T> for Datum<T>
Source§fn sub_assign(&mut self, other: T)
fn sub_assign(&mut self, other: T)
Performs the
-= operation. Read moreSource§impl<T: SubAssign> SubAssign for Datum<T>
impl<T: SubAssign> SubAssign for Datum<T>
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-= operation. Read moreimpl<T: Copy> Copy for Datum<T>
impl<T: Eq> Eq for Datum<T>
impl<T> StructuralPartialEq for Datum<T>
Auto Trait Implementations§
impl<T> Freeze for Datum<T>where
T: Freeze,
impl<T> RefUnwindSafe for Datum<T>where
T: RefUnwindSafe,
impl<T> Send for Datum<T>where
T: Send,
impl<T> Sync for Datum<T>where
T: Sync,
impl<T> Unpin for Datum<T>where
T: Unpin,
impl<T> UnwindSafe for Datum<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
Mutably borrows from an owned value. Read more