TimeDataMap

Struct TimeDataMap 

Source
pub struct TimeDataMap<T> {
    pub values: BTreeMap<Time, T>,
}
Expand description

A mapping from time to data values with interpolation support.

Stores time-value pairs in a BTreeMap for efficient time-based queries and supports various interpolation methods.

When the interpolation feature is enabled, each value can have an associated interpolation specification for animation curves.

Without interpolation feature: BTreeMap<Time, T>.

With interpolation feature an entry supports a [Key]s: BTreeMap<Time, (T, Option<Key<T>>)>.

Fields§

§values: BTreeMap<Time, T>

The time-value pairs with optional interpolation keys.

Implementations§

Source§

impl<T> TimeDataMap<T>

Source

pub fn iter(&self) -> impl Iterator<Item = (&Time, &T)>

Get an iterator over time-value pairs.

Source

pub fn is_empty(&self) -> bool

Check if empty.

Source

pub fn len(&self) -> usize

Get the number of entries.

Source§

impl<T> TimeDataMap<T>

Source

pub fn insert(&mut self, time: Time, value: T)

Insert a value at the given time.

Source

pub fn get(&self, time: &Time) -> Option<&T>

Get a value at the exact time.

Source§

impl<T> TimeDataMap<T>
where T: Clone + Add<Output = T> + Mul<f32, Output = T> + Sub<Output = T>,

Source

pub fn interpolate(&self, time: Time) -> T

Source§

impl<T> TimeDataMap<T>

Source

pub fn closest_sample(&self, time: Time) -> &T

Source

pub fn sample_at(&self, time: Time) -> Option<&T>

Sample value at exact time (no interpolation).

Source

pub fn sample_at_or_before(&self, time: Time) -> Option<&T>

Get the value at or before the given time.

Source

pub fn sample_at_or_after(&self, time: Time) -> Option<&T>

Get the value at or after the given time.

Source

pub fn sample_surrounding<const N: usize>( &self, time: Time, ) -> SmallVec<[(Time, &T); N]>

Get surrounding samples for interpolation.

Returns up to N samples centered around the given time for use in interpolation algorithms.

Trait Implementations§

Source§

impl<T> AnimatedDataOps for TimeDataMap<T>

Source§

fn len(&self) -> usize

Returns the number of time samples.
Source§

fn is_empty(&self) -> bool

Returns true if there are no time samples.
Source§

fn is_animated(&self) -> bool

Returns true if there is more than one time sample.
Source§

impl<T> AsRef<BTreeMap<Tick, T>> for TimeDataMap<T>

Available on non-crate feature interpolation only.
Source§

fn as_ref(&self) -> &BTreeMap<Time, T>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: Clone> Clone for TimeDataMap<T>

Source§

fn clone(&self) -> TimeDataMap<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> DataTypeOps for TimeDataMap<T>
where T: DataTypeOps,

Source§

fn data_type(&self) -> DataType

Returns the DataType variant for this value.
Source§

fn type_name(&self) -> &'static str

Returns a string name for this data type.
Source§

impl<T: Debug> Debug for TimeDataMap<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<(Tick, Boolean)> for TimeDataMap<Boolean>

Source§

fn from((time, value): (Time, Boolean)) -> Self

Converts to this type from the input type.
Source§

impl From<(Tick, BooleanVec)> for TimeDataMap<BooleanVec>

Source§

fn from((time, value): (Time, BooleanVec)) -> Self

Converts to this type from the input type.
Source§

impl From<(Tick, Color)> for TimeDataMap<Color>

Source§

fn from((time, value): (Time, Color)) -> Self

Converts to this type from the input type.
Source§

impl From<(Tick, ColorVec)> for TimeDataMap<ColorVec>

Source§

fn from((time, value): (Time, ColorVec)) -> Self

Converts to this type from the input type.
Source§

impl From<(Tick, Data)> for TimeDataMap<Data>

Source§

fn from((time, value): (Time, Data)) -> Self

Converts to this type from the input type.
Source§

impl From<(Tick, Integer)> for TimeDataMap<Integer>

Source§

fn from((time, value): (Time, Integer)) -> Self

Converts to this type from the input type.
Source§

impl From<(Tick, IntegerVec)> for TimeDataMap<IntegerVec>

Source§

fn from((time, value): (Time, IntegerVec)) -> Self

Converts to this type from the input type.
Source§

impl From<(Tick, Matrix3)> for TimeDataMap<Matrix3>

Source§

fn from((time, value): (Time, Matrix3)) -> Self

Converts to this type from the input type.
Source§

impl From<(Tick, Matrix3Vec)> for TimeDataMap<Matrix3Vec>

Source§

fn from((time, value): (Time, Matrix3Vec)) -> Self

Converts to this type from the input type.
Source§

impl From<(Tick, Real)> for TimeDataMap<Real>

Source§

fn from((time, value): (Time, Real)) -> Self

Converts to this type from the input type.
Source§

impl From<(Tick, RealVec)> for TimeDataMap<RealVec>

Source§

fn from((time, value): (Time, RealVec)) -> Self

Converts to this type from the input type.
Source§

impl From<(Tick, String)> for TimeDataMap<String>

Source§

fn from((time, value): (Time, String)) -> Self

Converts to this type from the input type.
Source§

impl From<(Tick, StringVec)> for TimeDataMap<StringVec>

Source§

fn from((time, value): (Time, StringVec)) -> Self

Converts to this type from the input type.
Source§

impl From<(Tick, Vector2)> for TimeDataMap<Vector2>

Source§

fn from((time, value): (Time, Vector2)) -> Self

Converts to this type from the input type.
Source§

impl From<(Tick, Vector2Vec)> for TimeDataMap<Vector2Vec>

Source§

fn from((time, value): (Time, Vector2Vec)) -> Self

Converts to this type from the input type.
Source§

impl<T> From<BTreeMap<Tick, T>> for TimeDataMap<T>

Source§

fn from(values: BTreeMap<Time, T>) -> Self

Converts to this type from the input type.
Source§

impl From<TimeDataMap<Boolean>> for AnimatedData

Source§

fn from(v: TimeDataMap<Boolean>) -> AnimatedData

Converts to this type from the input type.
Source§

impl From<TimeDataMap<BooleanVec>> for AnimatedData

Source§

fn from(v: TimeDataMap<BooleanVec>) -> AnimatedData

Converts to this type from the input type.
Source§

impl From<TimeDataMap<Color>> for AnimatedData

Source§

fn from(v: TimeDataMap<Color>) -> AnimatedData

Converts to this type from the input type.
Source§

impl From<TimeDataMap<ColorVec>> for AnimatedData

Source§

fn from(v: TimeDataMap<ColorVec>) -> AnimatedData

Converts to this type from the input type.
Source§

impl From<TimeDataMap<Integer>> for AnimatedData

Source§

fn from(v: TimeDataMap<Integer>) -> AnimatedData

Converts to this type from the input type.
Source§

impl From<TimeDataMap<IntegerVec>> for AnimatedData

Source§

fn from(v: TimeDataMap<IntegerVec>) -> AnimatedData

Converts to this type from the input type.
Source§

impl From<TimeDataMap<Matrix3>> for AnimatedData

Available on crate feature matrix3 only.
Source§

fn from(v: TimeDataMap<Matrix3>) -> AnimatedData

Converts to this type from the input type.
Source§

impl From<TimeDataMap<Matrix3Vec>> for AnimatedData

Available on crate features matrix3 and vec_variants only.
Source§

fn from(v: TimeDataMap<Matrix3Vec>) -> AnimatedData

Converts to this type from the input type.
Source§

impl From<TimeDataMap<Real>> for AnimatedData

Source§

fn from(v: TimeDataMap<Real>) -> AnimatedData

Converts to this type from the input type.
Source§

impl From<TimeDataMap<RealVec>> for AnimatedData

Source§

fn from(v: TimeDataMap<RealVec>) -> AnimatedData

Converts to this type from the input type.
Source§

impl From<TimeDataMap<String>> for AnimatedData

Source§

fn from(v: TimeDataMap<String>) -> AnimatedData

Converts to this type from the input type.
Source§

impl From<TimeDataMap<StringVec>> for AnimatedData

Source§

fn from(v: TimeDataMap<StringVec>) -> AnimatedData

Converts to this type from the input type.
Source§

impl From<TimeDataMap<Vector2>> for AnimatedData

Available on crate feature vector2 only.
Source§

fn from(v: TimeDataMap<Vector2>) -> AnimatedData

Converts to this type from the input type.
Source§

impl From<TimeDataMap<Vector2Vec>> for AnimatedData

Available on crate features vector2 and vec_variants only.
Source§

fn from(v: TimeDataMap<Vector2Vec>) -> AnimatedData

Converts to this type from the input type.
Source§

impl<T, V> FromIterator<(Tick, V)> for TimeDataMap<T>
where V: Into<T>,

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = (Time, V)>,

Creates a value from an iterator. Read more
Source§

impl<T: Hash> Hash for TimeDataMap<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: PartialEq> PartialEq for TimeDataMap<T>

Source§

fn eq(&self, other: &TimeDataMap<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Sample<Color> for TimeDataMap<Color>

Source§

fn sample( &self, shutter: &Shutter, samples: NonZeroU16, ) -> Result<Vec<(Color, SampleWeight)>>

Generate samples across the shutter interval. Read more
Source§

impl Sample<Integer> for TimeDataMap<Integer>

Source§

fn sample( &self, shutter: &Shutter, samples: NonZeroU16, ) -> Result<Vec<(Integer, SampleWeight)>>

Generate samples across the shutter interval. Read more
Source§

impl Sample<Matrix3> for TimeDataMap<Matrix3>

Available on crate feature matrix3 only.
Source§

fn sample( &self, shutter: &Shutter, samples: NonZeroU16, ) -> Result<Vec<(Matrix3, SampleWeight)>>

Generate samples across the shutter interval. Read more
Source§

impl Sample<Real> for TimeDataMap<Real>

Source§

fn sample( &self, shutter: &Shutter, samples: NonZeroU16, ) -> Result<Vec<(Real, SampleWeight)>>

Generate samples across the shutter interval. Read more
Source§

impl Sample<Vector2> for TimeDataMap<Vector2>

Source§

fn sample( &self, shutter: &Shutter, samples: NonZeroU16, ) -> Result<Vec<(Vector2, SampleWeight)>>

Generate samples across the shutter interval. Read more
Source§

impl<T> TimeDataMapControl<T> for TimeDataMap<T>

Source§

fn len(&self) -> usize

Returns the number of time samples.
Source§

fn is_empty(&self) -> bool

Returns true if there are no time samples.
Source§

fn is_animated(&self) -> bool

Returns true if there is more than one time sample.
Source§

impl TryInto<TimeDataMap<Boolean>> for AnimatedData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<TimeDataMap<Boolean>, <Self as TryInto<TimeDataMap<Boolean>>>::Error>

Performs the conversion.
Source§

impl TryInto<TimeDataMap<BooleanVec>> for AnimatedData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<TimeDataMap<BooleanVec>, <Self as TryInto<TimeDataMap<BooleanVec>>>::Error>

Performs the conversion.
Source§

impl TryInto<TimeDataMap<Color>> for AnimatedData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<TimeDataMap<Color>, <Self as TryInto<TimeDataMap<Color>>>::Error>

Performs the conversion.
Source§

impl TryInto<TimeDataMap<ColorVec>> for AnimatedData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<TimeDataMap<ColorVec>, <Self as TryInto<TimeDataMap<ColorVec>>>::Error>

Performs the conversion.
Source§

impl TryInto<TimeDataMap<Integer>> for AnimatedData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<TimeDataMap<Integer>, <Self as TryInto<TimeDataMap<Integer>>>::Error>

Performs the conversion.
Source§

impl TryInto<TimeDataMap<IntegerVec>> for AnimatedData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<TimeDataMap<IntegerVec>, <Self as TryInto<TimeDataMap<IntegerVec>>>::Error>

Performs the conversion.
Source§

impl TryInto<TimeDataMap<Matrix3>> for AnimatedData

Available on crate feature matrix3 only.
Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<TimeDataMap<Matrix3>, <Self as TryInto<TimeDataMap<Matrix3>>>::Error>

Performs the conversion.
Source§

impl TryInto<TimeDataMap<Matrix3Vec>> for AnimatedData

Available on crate features matrix3 and vec_variants only.
Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<TimeDataMap<Matrix3Vec>, <Self as TryInto<TimeDataMap<Matrix3Vec>>>::Error>

Performs the conversion.
Source§

impl TryInto<TimeDataMap<Real>> for AnimatedData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<TimeDataMap<Real>, <Self as TryInto<TimeDataMap<Real>>>::Error>

Performs the conversion.
Source§

impl TryInto<TimeDataMap<RealVec>> for AnimatedData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<TimeDataMap<RealVec>, <Self as TryInto<TimeDataMap<RealVec>>>::Error>

Performs the conversion.
Source§

impl TryInto<TimeDataMap<String>> for AnimatedData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<TimeDataMap<String>, <Self as TryInto<TimeDataMap<String>>>::Error>

Performs the conversion.
Source§

impl TryInto<TimeDataMap<StringVec>> for AnimatedData

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<TimeDataMap<StringVec>, <Self as TryInto<TimeDataMap<StringVec>>>::Error>

Performs the conversion.
Source§

impl TryInto<TimeDataMap<Vector2>> for AnimatedData

Available on crate feature vector2 only.
Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<TimeDataMap<Vector2>, <Self as TryInto<TimeDataMap<Vector2>>>::Error>

Performs the conversion.
Source§

impl TryInto<TimeDataMap<Vector2Vec>> for AnimatedData

Available on crate features vector2 and vec_variants only.
Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_into( self, ) -> Result<TimeDataMap<Vector2Vec>, <Self as TryInto<TimeDataMap<Vector2Vec>>>::Error>

Performs the conversion.
Source§

impl<T: Eq> Eq for TimeDataMap<T>

Source§

impl<T> StructuralPartialEq for TimeDataMap<T>

Auto Trait Implementations§

§

impl<T> Freeze for TimeDataMap<T>

§

impl<T> RefUnwindSafe for TimeDataMap<T>
where T: RefUnwindSafe,

§

impl<T> Send for TimeDataMap<T>
where T: Send,

§

impl<T> Sync for TimeDataMap<T>
where T: Sync,

§

impl<T> Unpin for TimeDataMap<T>

§

impl<T> UnwindSafe for TimeDataMap<T>
where T: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,