pub struct KeyDataMap<K, V> {
pub values: BTreeMap1<K, V>,
}Expand description
A generic key-value data map with interpolation support.
Stores key-value pairs in a BTreeMap1 for efficient ordered
queries and supports various interpolation methods. The map is
guaranteed to be non-empty at the type level.
When the interpolation feature is enabled, each value can have an
associated interpolation specification for animation curves.
Use the type alias TimeDataMap<V> for time-keyed maps (the common case),
or use KeyDataMap<Position, V> for curve-domain maps.
Fields§
§values: BTreeMap1<K, V>The key-value pairs with optional interpolation keys.
Guaranteed non-empty by BTreeMap1.
Implementations§
Source§impl<K: Ord, V> KeyDataMap<K, V>
impl<K: Ord, V> KeyDataMap<K, V>
Source§impl<K: Ord, V> KeyDataMap<K, V>
impl<K: Ord, V> KeyDataMap<K, V>
Sourcepub fn from_single(key: K, value: V) -> Self
pub fn from_single(key: K, value: V) -> Self
Create a map with a single key-value pair.
Source§impl<K: Ord, V> KeyDataMap<K, V>
impl<K: Ord, V> KeyDataMap<K, V>
Source§impl<K, V> KeyDataMap<K, V>
impl<K, V> KeyDataMap<K, V>
pub fn interpolate(&self, key: K) -> V
Source§impl<K: Ord + Copy + Into<f32>, V> KeyDataMap<K, V>
impl<K: Ord + Copy + Into<f32>, V> KeyDataMap<K, V>
pub fn sample_closest_at(&self, key: K) -> &V
Sourcepub fn sample_at_or_before(&self, key: K) -> Option<&V>
pub fn sample_at_or_before(&self, key: K) -> Option<&V>
Get the value at or before the given key.
Sourcepub fn sample_at_or_after(&self, key: K) -> Option<&V>
pub fn sample_at_or_after(&self, key: K) -> Option<&V>
Get the value at or after the given key.
Sourcepub fn sample_surrounding<const N: usize>(
&self,
key: K,
) -> SmallVec<[(K, &V); N]>
pub fn sample_surrounding<const N: usize>( &self, key: K, ) -> SmallVec<[(K, &V); N]>
Get surrounding samples for interpolation.
Returns up to N samples centered around the given key for
use in interpolation algorithms.
Sourcepub fn closest_sample(&self, key: K) -> &V
👎Deprecated since 0.2.3: renamed to sample_closest_at
pub fn closest_sample(&self, key: K) -> &V
sample_closest_atDeprecated alias for sample_closest_at.
Trait Implementations§
Source§impl<K, V> AsRef<BTreeMap<K, V>> for KeyDataMap<K, V>
Available on non-crate feature interpolation only.
impl<K, V> AsRef<BTreeMap<K, V>> for KeyDataMap<K, V>
interpolation only.Source§impl<K: Clone, V: Clone> Clone for KeyDataMap<K, V>
impl<K: Clone, V: Clone> Clone for KeyDataMap<K, V>
Source§fn clone(&self) -> KeyDataMap<K, V>
fn clone(&self) -> KeyDataMap<K, V>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<K: Ord, V> DataTypeOps for KeyDataMap<K, V>where
V: DataTypeOps,
Available on crate feature builtin-types only.
impl<K: Ord, V> DataTypeOps for KeyDataMap<K, V>where
V: DataTypeOps,
builtin-types only.Source§impl From<KeyDataMap<Tick, Boolean>> for AnimatedData
impl From<KeyDataMap<Tick, Boolean>> for AnimatedData
Source§fn from(v: TimeDataMap<Boolean>) -> AnimatedData
fn from(v: TimeDataMap<Boolean>) -> AnimatedData
Source§impl From<KeyDataMap<Tick, BooleanVec>> for AnimatedData
impl From<KeyDataMap<Tick, BooleanVec>> for AnimatedData
Source§fn from(v: TimeDataMap<BooleanVec>) -> AnimatedData
fn from(v: TimeDataMap<BooleanVec>) -> AnimatedData
Source§impl From<KeyDataMap<Tick, Color>> for AnimatedData
impl From<KeyDataMap<Tick, Color>> for AnimatedData
Source§fn from(v: TimeDataMap<Color>) -> AnimatedData
fn from(v: TimeDataMap<Color>) -> AnimatedData
Source§impl From<KeyDataMap<Tick, ColorCurve>> for AnimatedData
Available on crate feature curves only.
impl From<KeyDataMap<Tick, ColorCurve>> for AnimatedData
curves only.Source§fn from(v: TimeDataMap<ColorCurve>) -> AnimatedData
fn from(v: TimeDataMap<ColorCurve>) -> AnimatedData
Source§impl From<KeyDataMap<Tick, ColorVec>> for AnimatedData
impl From<KeyDataMap<Tick, ColorVec>> for AnimatedData
Source§fn from(v: TimeDataMap<ColorVec>) -> AnimatedData
fn from(v: TimeDataMap<ColorVec>) -> AnimatedData
Source§impl From<KeyDataMap<Tick, Integer>> for AnimatedData
impl From<KeyDataMap<Tick, Integer>> for AnimatedData
Source§fn from(v: TimeDataMap<Integer>) -> AnimatedData
fn from(v: TimeDataMap<Integer>) -> AnimatedData
Source§impl From<KeyDataMap<Tick, IntegerVec>> for AnimatedData
impl From<KeyDataMap<Tick, IntegerVec>> for AnimatedData
Source§fn from(v: TimeDataMap<IntegerVec>) -> AnimatedData
fn from(v: TimeDataMap<IntegerVec>) -> AnimatedData
Source§impl From<KeyDataMap<Tick, Matrix3>> for AnimatedData
Available on crate feature matrix3 only.
impl From<KeyDataMap<Tick, Matrix3>> for AnimatedData
matrix3 only.Source§fn from(v: TimeDataMap<Matrix3>) -> AnimatedData
fn from(v: TimeDataMap<Matrix3>) -> AnimatedData
Source§impl From<KeyDataMap<Tick, Matrix3Vec>> for AnimatedData
Available on crate features matrix3 and vec_variants only.
impl From<KeyDataMap<Tick, Matrix3Vec>> for AnimatedData
matrix3 and vec_variants only.Source§fn from(v: TimeDataMap<Matrix3Vec>) -> AnimatedData
fn from(v: TimeDataMap<Matrix3Vec>) -> AnimatedData
Source§impl From<KeyDataMap<Tick, Real>> for AnimatedData
impl From<KeyDataMap<Tick, Real>> for AnimatedData
Source§fn from(v: TimeDataMap<Real>) -> AnimatedData
fn from(v: TimeDataMap<Real>) -> AnimatedData
Source§impl From<KeyDataMap<Tick, RealCurve>> for AnimatedData
Available on crate feature curves only.
impl From<KeyDataMap<Tick, RealCurve>> for AnimatedData
curves only.Source§fn from(v: TimeDataMap<RealCurve>) -> AnimatedData
fn from(v: TimeDataMap<RealCurve>) -> AnimatedData
Source§impl From<KeyDataMap<Tick, RealVec>> for AnimatedData
impl From<KeyDataMap<Tick, RealVec>> for AnimatedData
Source§fn from(v: TimeDataMap<RealVec>) -> AnimatedData
fn from(v: TimeDataMap<RealVec>) -> AnimatedData
Source§impl From<KeyDataMap<Tick, String>> for AnimatedData
impl From<KeyDataMap<Tick, String>> for AnimatedData
Source§fn from(v: TimeDataMap<String>) -> AnimatedData
fn from(v: TimeDataMap<String>) -> AnimatedData
Source§impl From<KeyDataMap<Tick, StringVec>> for AnimatedData
impl From<KeyDataMap<Tick, StringVec>> for AnimatedData
Source§fn from(v: TimeDataMap<StringVec>) -> AnimatedData
fn from(v: TimeDataMap<StringVec>) -> AnimatedData
Source§impl From<KeyDataMap<Tick, Vector2>> for AnimatedData
Available on crate feature vector2 only.
impl From<KeyDataMap<Tick, Vector2>> for AnimatedData
vector2 only.Source§fn from(v: TimeDataMap<Vector2>) -> AnimatedData
fn from(v: TimeDataMap<Vector2>) -> AnimatedData
Source§impl From<KeyDataMap<Tick, Vector2Vec>> for AnimatedData
Available on crate features vector2 and vec_variants only.
impl From<KeyDataMap<Tick, Vector2Vec>> for AnimatedData
vector2 and vec_variants only.Source§fn from(v: TimeDataMap<Vector2Vec>) -> AnimatedData
fn from(v: TimeDataMap<Vector2Vec>) -> AnimatedData
Source§impl<K: Ord, V> From<NonEmpty<BTreeMap<K, V>>> for KeyDataMap<K, V>
Available on non-crate feature interpolation only.
impl<K: Ord, V> From<NonEmpty<BTreeMap<K, V>>> for KeyDataMap<K, V>
interpolation only.Source§impl<K: Ord, V, U> FromIterator<(K, U)> for KeyDataMap<K, V>where
U: Into<V>,
impl<K: Ord, V, U> FromIterator<(K, U)> for KeyDataMap<K, V>where
U: Into<V>,
Source§impl<V> TimeDataMapControl<V> for KeyDataMap<Time, V>
impl<V> TimeDataMapControl<V> for KeyDataMap<Time, V>
Source§impl TryInto<KeyDataMap<Tick, Boolean>> for AnimatedData
impl TryInto<KeyDataMap<Tick, Boolean>> for AnimatedData
Source§impl TryInto<KeyDataMap<Tick, BooleanVec>> for AnimatedData
impl TryInto<KeyDataMap<Tick, BooleanVec>> for AnimatedData
Source§fn try_into(
self,
) -> Result<TimeDataMap<BooleanVec>, <Self as TryInto<TimeDataMap<BooleanVec>>>::Error>
fn try_into( self, ) -> Result<TimeDataMap<BooleanVec>, <Self as TryInto<TimeDataMap<BooleanVec>>>::Error>
Source§impl TryInto<KeyDataMap<Tick, Color>> for AnimatedData
impl TryInto<KeyDataMap<Tick, Color>> for AnimatedData
Source§impl TryInto<KeyDataMap<Tick, ColorCurve>> for AnimatedData
Available on crate feature curves only.
impl TryInto<KeyDataMap<Tick, ColorCurve>> for AnimatedData
curves only.Source§fn try_into(
self,
) -> Result<TimeDataMap<ColorCurve>, <Self as TryInto<TimeDataMap<ColorCurve>>>::Error>
fn try_into( self, ) -> Result<TimeDataMap<ColorCurve>, <Self as TryInto<TimeDataMap<ColorCurve>>>::Error>
Source§impl TryInto<KeyDataMap<Tick, ColorVec>> for AnimatedData
impl TryInto<KeyDataMap<Tick, ColorVec>> for AnimatedData
Source§impl TryInto<KeyDataMap<Tick, Integer>> for AnimatedData
impl TryInto<KeyDataMap<Tick, Integer>> for AnimatedData
Source§impl TryInto<KeyDataMap<Tick, IntegerVec>> for AnimatedData
impl TryInto<KeyDataMap<Tick, IntegerVec>> for AnimatedData
Source§fn try_into(
self,
) -> Result<TimeDataMap<IntegerVec>, <Self as TryInto<TimeDataMap<IntegerVec>>>::Error>
fn try_into( self, ) -> Result<TimeDataMap<IntegerVec>, <Self as TryInto<TimeDataMap<IntegerVec>>>::Error>
Source§impl TryInto<KeyDataMap<Tick, Matrix3>> for AnimatedData
Available on crate feature matrix3 only.
impl TryInto<KeyDataMap<Tick, Matrix3>> for AnimatedData
matrix3 only.Source§impl TryInto<KeyDataMap<Tick, Matrix3Vec>> for AnimatedData
Available on crate features matrix3 and vec_variants only.
impl TryInto<KeyDataMap<Tick, Matrix3Vec>> for AnimatedData
matrix3 and vec_variants only.Source§fn try_into(
self,
) -> Result<TimeDataMap<Matrix3Vec>, <Self as TryInto<TimeDataMap<Matrix3Vec>>>::Error>
fn try_into( self, ) -> Result<TimeDataMap<Matrix3Vec>, <Self as TryInto<TimeDataMap<Matrix3Vec>>>::Error>
Source§impl TryInto<KeyDataMap<Tick, Real>> for AnimatedData
impl TryInto<KeyDataMap<Tick, Real>> for AnimatedData
Source§impl TryInto<KeyDataMap<Tick, RealCurve>> for AnimatedData
Available on crate feature curves only.
impl TryInto<KeyDataMap<Tick, RealCurve>> for AnimatedData
curves only.Source§impl TryInto<KeyDataMap<Tick, RealVec>> for AnimatedData
impl TryInto<KeyDataMap<Tick, RealVec>> for AnimatedData
Source§impl TryInto<KeyDataMap<Tick, String>> for AnimatedData
impl TryInto<KeyDataMap<Tick, String>> for AnimatedData
Source§impl TryInto<KeyDataMap<Tick, StringVec>> for AnimatedData
impl TryInto<KeyDataMap<Tick, StringVec>> for AnimatedData
Source§impl TryInto<KeyDataMap<Tick, Vector2>> for AnimatedData
Available on crate feature vector2 only.
impl TryInto<KeyDataMap<Tick, Vector2>> for AnimatedData
vector2 only.Source§impl TryInto<KeyDataMap<Tick, Vector2Vec>> for AnimatedData
Available on crate features vector2 and vec_variants only.
impl TryInto<KeyDataMap<Tick, Vector2Vec>> for AnimatedData
vector2 and vec_variants only.Source§fn try_into(
self,
) -> Result<TimeDataMap<Vector2Vec>, <Self as TryInto<TimeDataMap<Vector2Vec>>>::Error>
fn try_into( self, ) -> Result<TimeDataMap<Vector2Vec>, <Self as TryInto<TimeDataMap<Vector2Vec>>>::Error>
impl<K: Eq, V: Eq> Eq for KeyDataMap<K, V>
impl<K, V> StructuralPartialEq for KeyDataMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for KeyDataMap<K, V>
impl<K, V> RefUnwindSafe for KeyDataMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for KeyDataMap<K, V>
impl<K, V> Sync for KeyDataMap<K, V>
impl<K, V> Unpin for KeyDataMap<K, V>
impl<K, V> UnsafeUnpin for KeyDataMap<K, V>
impl<K, V> UnwindSafe for KeyDataMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
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,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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