[−][src]Struct tsxlib::index::HashableIndex
a HashableIndex
Fields
values: Vec<TIndex>
Implementations
impl HashableIndex<NaiveDateTime>
[src]
pub fn from_int_stamps(stamps: Vec<i64>) -> HashableIndex<NaiveDateTime>
[src]
impl<TIndex: Serialize + Hash + Clone + Eq + Ord> HashableIndex<TIndex>
[src]
pub fn new(values: Vec<TIndex>) -> HashableIndex<TIndex>
[src]
Create new index from a vec of values of type TIndex
Example
use tsxlib::index::HashableIndex; let values = vec![1, 2, 3, 4]; let index = HashableIndex::new(values); assert_eq!(index.len(), 4);
pub fn is_monotonic(&self) -> bool
[src]
test the monotonicity test for an index
Example
use tsxlib::index::HashableIndex; let vs = HashableIndex::new(vec![1, 2, 3, 4]); let xs = HashableIndex::new(vec![1, 2, 3, 3]); let ys = HashableIndex::new(vec![1, 2, 3, 2]); assert_eq!(vs.is_monotonic(), true); assert_eq!(xs.is_monotonic(), false); assert_eq!(ys.is_monotonic(), false);
pub fn len(&self) -> usize
[src]
get length of the index
pub fn is_empty(&self) -> bool
[src]
is the index empty
pub fn last(&self) -> Option<&TIndex>
[src]
ref to the last value of an index
pub fn is_unique(&self) -> bool
[src]
very slow, tests if index is unique by generating a hashset of the index keys and then comparing lengths
pub fn iter(&self) -> Iter<'_, TIndex>
[src]
generate and iterator for the index
Trait Implementations
impl<TIndex: Clone + Serialize + Hash + Eq + Ord> Clone for HashableIndex<TIndex>
[src]
pub fn clone(&self) -> HashableIndex<TIndex>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<TIndex: Debug + Serialize + Hash + Clone + Eq + Ord> Debug for HashableIndex<TIndex>
[src]
impl<TIndex: Serialize + Hash + Clone + Eq + Ord> Index<usize> for HashableIndex<TIndex>
[src]
type Output = TIndex
The returned type after indexing.
pub fn index(&self, pos: usize) -> &Self::Output
[src]
impl<TIndex: Serialize + Hash + Clone + Eq + Ord> PartialEq<HashableIndex<TIndex>> for HashableIndex<TIndex>
[src]
pub fn eq(&self, other: &Self) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl SampleableIndex<NaiveDateTime, Duration> for HashableIndex<NaiveDateTime>
[src]
Implementation of SampleableIndex for HashableIndex
pub fn sample_rates(&self) -> Vec<(usize, Duration)>
[src]
Infer index sample rate, returns a vector that represtest (number of times a sample rate is observed, the sample rate)
Example
use tsxlib::index::HashableIndex; use tsxlib::index::SampleableIndex; use tsxlib::timeutils; use chrono::{NaiveDateTime,Duration}; let index = HashableIndex::new(vec![ timeutils::naive_datetime_from_millis(0), timeutils::naive_datetime_from_millis(5),timeutils::naive_datetime_from_millis(10), timeutils::naive_datetime_from_millis(15), timeutils::naive_datetime_from_millis(20), timeutils::naive_datetime_from_millis(25), timeutils::naive_datetime_from_millis(75)]); let exp = vec![(5,Duration::milliseconds(5)),(1,Duration::milliseconds(50))]; assert_eq!(index.sample_rates(), exp);
pub fn is_mono_intervaled(&self) -> bool
[src]
returns true if the index is spaced at equal itervals
Example
use tsxlib::index::HashableIndex; use tsxlib::index::SampleableIndex; use tsxlib::timeutils; use chrono::{NaiveDateTime,Duration}; let index = HashableIndex::new(vec![ timeutils::naive_datetime_from_millis(0), timeutils::naive_datetime_from_millis(5),timeutils::naive_datetime_from_millis(10), timeutils::naive_datetime_from_millis(15), timeutils::naive_datetime_from_millis(20), timeutils::naive_datetime_from_millis(25), timeutils::naive_datetime_from_millis(75)]); let index_mono = HashableIndex::new(vec![ timeutils::naive_datetime_from_millis(0), timeutils::naive_datetime_from_millis(5),timeutils::naive_datetime_from_millis(10), timeutils::naive_datetime_from_millis(15), timeutils::naive_datetime_from_millis(20), timeutils::naive_datetime_from_millis(25)]); assert_eq!(index.is_mono_intervaled(), false); assert_eq!(index_mono.is_mono_intervaled(), true);
Auto Trait Implementations
impl<TIndex> RefUnwindSafe for HashableIndex<TIndex> where
TIndex: RefUnwindSafe,
[src]
TIndex: RefUnwindSafe,
impl<TIndex> Send for HashableIndex<TIndex> where
TIndex: Send,
[src]
TIndex: Send,
impl<TIndex> Sync for HashableIndex<TIndex> where
TIndex: Sync,
[src]
TIndex: Sync,
impl<TIndex> Unpin for HashableIndex<TIndex> where
TIndex: Unpin,
[src]
TIndex: Unpin,
impl<TIndex> UnwindSafe for HashableIndex<TIndex> where
TIndex: UnwindSafe,
[src]
TIndex: 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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,