[−][src]Enum eyros::Mix
The Mix implementations allow you to use scalar or interval values for each dimension. The storage overhead is a one-byte bitfield (for up to 8 dimensions) at the beginning of each record to specify which dimensions in the given record are scalars and which are intervals.
To define a Mix coordinate, call the appropriate Mix{2..8}::new()
method
for the dimension of your database, wrapping each item in the constructor
with either Mix::Interval(min,max)
or Mix::Scalar(x)
.
For example, to construct a 3-dimensional row using Mix coordinates:
use eyros::{Row,Mix,Mix3}; let rows = vec![ Row::Insert(Mix3::new( Mix::Interval(3.0_f32, 10.0_f32), Mix::Scalar(-4.5_f32), Mix::Scalar(1234_u32) ), 55555_u64), Row::Insert(Mix3::new( Mix::Scalar(32.8_f32), Mix::Scalar(-12.5_f32), Mix::Interval(500_u32,800_u32) ), 33333_u64) ];
When you get a Mix
result from a query, you can access the elements for
each dimension with the v0
, v1
, ... properties or by calling .into()
to convert into a tuple.
use eyros::{Mix,Mix2}; let mix_point: Mix2<f32,f32> = Mix2::new( Mix::Scalar(2.0), Mix::Interval(-3.0,1.0) ); assert_eq![mix_point.v0, Mix::Scalar(2.0)]; assert_eq![mix_point.v1, Mix::Interval(-3.0,1.0)]; let tuple: (Mix<f32>,Mix<f32>) = mix_point.into(); assert_eq![tuple, (Mix::Scalar(2.0),Mix::Interval(-3.0,1.0))]; // Likewise, you can cast a tuple back into a mix: let m: Mix2<f32,f32> = tuple.into(); assert_eq![m, Mix2::new(Mix::Scalar(2.0),Mix::Interval(-3.0,1.0))];
Define a value to use for a single dimension: either a scalar (a single value) or an interval (min, max).
Variants
Trait Implementations
impl<T: Clone> Clone for Mix<T>
[src]
impl<T: Copy> Copy for Mix<T>
[src]
impl<T: Debug> Debug for Mix<T>
[src]
impl<T: Eq> Eq for Mix<T>
[src]
impl<T: PartialEq> PartialEq<Mix<T>> for Mix<T>
[src]
impl<T> StructuralEq for Mix<T>
[src]
impl<T> StructuralPartialEq for Mix<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Mix<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Mix<T> where
T: Send,
T: Send,
impl<T> Sync for Mix<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Mix<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Mix<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,