SimpleFeature

Struct SimpleFeature 

Source
pub struct SimpleFeature<X, Y> {
    pub label: f64,
    /* private fields */
}
Expand description

A feature-like type that doesn’t have a variable first dimension, instead using a constant value

Fields§

§label: f64

A constant value for the first dimension

Implementations§

Source§

impl<X, Y> SimpleFeature<X, Y>

Source

pub fn new(label: f64, y: Vec<f64>, z: Vec<f32>) -> Self

Source

pub fn as_view(&self) -> SimpleFeatureView<'_, X, Y>

Source

pub fn into_inner(self) -> (f64, Vec<f64>, Vec<f32>)

Source

pub fn empty(label: f64) -> Self

Create an empty SimpleFeature

Source

pub fn with_capacity(capacity: usize, label: f64) -> Self

Createa a new empty SimpleFeature with pre-allocated capacity

Source

pub fn push<T: CoordinateLike<X> + IntensityMeasurement>( &mut self, pt: &T, time: f64, )

Push a new data point onto the feature and ensure the time ordering invariant is satisfied.

Source

pub fn push_raw(&mut self, _x: f64, y: f64, z: f32)

Push a new data point onto the feature and ensure the time ordering invariant is satisfied.

Trait Implementations§

Source§

impl<X: Clone, Y: Clone> Clone for SimpleFeature<X, Y>

Source§

fn clone(&self) -> SimpleFeature<X, Y>

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<X, Y> CoordinateLike<X> for SimpleFeature<X, Y>

Source§

fn coordinate(&self) -> f64

The trait method for accessing the coordinate of the object on coordinate system T
Source§

impl<X: Debug, Y: Debug> Debug for SimpleFeature<X, Y>

Source§

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

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

impl<X: Default, Y: Default> Default for SimpleFeature<X, Y>

Source§

fn default() -> SimpleFeature<X, Y>

Returns the “default value” for a type. Read more
Source§

impl<X, Y, P: CoordinateLike<X> + IntensityMeasurement> Extend<(P, f64)> for SimpleFeature<X, Y>

Source§

fn extend<T: IntoIterator<Item = (P, f64)>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<X, Y> Extend<(f64, f64, f32)> for SimpleFeature<X, Y>

Source§

fn extend<T: IntoIterator<Item = (f64, f64, f32)>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<X, Y> FeatureLike<X, Y> for SimpleFeature<X, Y>

Source§

fn len(&self) -> usize

The number of points in the feature
Source§

fn iter(&self) -> impl Iterator<Item = (f64, f64, f32)>

Create an iterator that yields (x, y, intensity) references
Source§

fn is_empty(&self) -> bool

Check if the feature has any points in it
Source§

fn at(&self, index: usize) -> Option<(f64, f64, f32)>

Get an immutable reference to feature data at a specified index
Source§

fn first(&self) -> Option<(f64, f64, f32)>

Retrieve the first time point, if it exists
Source§

fn last(&self) -> Option<(f64, f64, f32)>

Retrieve the last time point, if it exists
Source§

fn at_time(&self, time: f64) -> Option<(f64, f64, f32)>

Get an immutable reference to feature data at a specified time.Analogous to combining TimeInterval::find_time with FeatureLike::at
Source§

impl<X, Y> FeatureLikeMut<X, Y> for SimpleFeature<X, Y>

Source§

fn iter_mut(&mut self) -> impl Iterator<Item = (&mut f64, &mut f64, &mut f32)>

Create an iterator that yields (x, y, intensity) mutable references Read more
Source§

fn push<T: CoordinateLike<X> + IntensityMeasurement>( &mut self, pt: &T, time: f64, )

Add a new peak-like reference to the feature at a given y “time” coordinate. If the “time” is not in sorted order, it should automatically re-sort.
Source§

fn push_raw(&mut self, x: f64, y: f64, z: f32)

As FeatureLikeMut::push, but instead add raw values instead of deriving them from a peak-like reference.
Source§

fn clear(&mut self)

Clear all the series dimensions. Read more
Source§

fn reserve(&mut self, capacity: usize)

Optimistically reserve additional space for capacity entries in the underlying storage. Read more
Source§

fn at_mut(&mut self, index: usize) -> Option<(&mut f64, f64, &mut f32)>

Get a mutable reference to feature data at a specified index
Source§

fn first_mut(&mut self) -> Option<(&mut f64, f64, &mut f32)>

Get a mutable reference to feature data at the first index, if it exists
Source§

fn last_mut(&mut self) -> Option<(&mut f64, f64, &mut f32)>

Get a mutable reference to feature data at the last index, if it exists
Source§

fn at_time_mut(&mut self, time: f64) -> Option<(&mut f64, f64, &mut f32)>

Get a mutable reference to feature data at a specified time. Analogous to combining TimeInterval::find_time with FeatureLikeMut::at_mut
Source§

impl<X, Y, P: CoordinateLike<X> + IntensityMeasurement> FromIterator<(P, f64)> for SimpleFeature<X, Y>

Source§

fn from_iter<T: IntoIterator<Item = (P, f64)>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl<X, Y> FromIterator<(f64, f64, f32)> for SimpleFeature<X, Y>

Source§

fn from_iter<T: IntoIterator<Item = (f64, f64, f32)>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl<X, Y> IntensityMeasurement for SimpleFeature<X, Y>

Source§

fn intensity(&self) -> f32

Source§

impl<X, Y> IntoIterator for SimpleFeature<X, Y>

Source§

type Item = (f64, f64, f32)

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<X, Y>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<X, Y> PartialEq for SimpleFeature<X, Y>

Source§

fn eq(&self, other: &Self) -> 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<X, Y> PartialOrd for SimpleFeature<X, Y>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a, X, Y> SplittableFeatureLike<'a, X, Y> for SimpleFeature<X, Y>

Source§

type ViewType = SimpleFeatureView<'a, X, Y>

The type that will hold the split feature parts. They could be borrowed or own a copy of their original data.
Source§

fn split_at(&'a self, index: usize) -> (Self::ViewType, Self::ViewType)

Split the feature at index, segmenting before and after it. The position at index should be retained in the second segment.
Source§

fn split_at_time(&'a self, point: f64) -> (Self::ViewType, Self::ViewType)

Split the feature at time. Read more
Source§

fn slice<I: RangeBounds<usize> + Clone>(&'a self, bounds: I) -> Self::ViewType

Select the positions given by the range of positions in bounds
Source§

fn split_mask(&'a self, mask: &[bool]) -> Vec<Self::ViewType>

Retain all positions where mask is true, keeping contiguous positions part of the same feature segments. Read more
Source§

fn split_when<F>(&'a self, f: F) -> Vec<Self::ViewType>
where F: FnMut((f64, f64, f32), (f64, f64, f32)) -> bool,

Given a function f that takes successive pairs of points of (dim1, dim2, intensity) and returns a bool, mask all out all positions where f returns true. Read more
Source§

fn split_sparse(&'a self, max_gap_size: f64) -> Vec<Self::ViewType>

Split the feature when there is a gap of size max_gap_size or more in the time dimension
Source§

impl<X, Y> TimeArray<Y> for SimpleFeature<X, Y>

Source§

fn time_view(&self) -> &[f64]

A slice over the complete time dimension
Source§

fn intensity_view(&self) -> &[f32]

A slice over the complete intensity dimension
Source§

impl<X, Y> TimeInterval<Y> for SimpleFeature<X, Y>

Source§

fn start_time(&self) -> Option<f64>

The earliest time point recorded
Source§

fn end_time(&self) -> Option<f64>

The latest time point recorded
Source§

fn apex_time(&self) -> Option<f64>

The time point where the feature reaches its greatest intensity
Source§

fn area(&self) -> f32

Integrate the feature in the time dimension
Source§

fn iter_time(&self) -> impl Iterator<Item = f64>

Return an iterator over the time dimension
Source§

fn find_time(&self, time: f64) -> (Option<usize>, f64)

Find the position in the interval closest to the requested time and the magnitude of the error
Source§

fn as_range(&self) -> CoordinateRange<T>

Represent the TimeInterval into a CoordinateRange
Source§

fn spans(&self, time: f64) -> bool

Check if a time point is spanned by TimeInterval

Auto Trait Implementations§

§

impl<X, Y> Freeze for SimpleFeature<X, Y>

§

impl<X, Y> RefUnwindSafe for SimpleFeature<X, Y>

§

impl<X, Y> Send for SimpleFeature<X, Y>
where X: Send, Y: Send,

§

impl<X, Y> Sync for SimpleFeature<X, Y>
where X: Sync, Y: Sync,

§

impl<X, Y> Unpin for SimpleFeature<X, Y>
where X: Unpin, Y: Unpin,

§

impl<X, Y> UnwindSafe for SimpleFeature<X, Y>
where X: UnwindSafe, Y: UnwindSafe,

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> IonMobilityLocated for T

Source§

impl<T> MZLocated for T
where T: CoordinateLike<MZ>,

Source§

fn mz(&self) -> f64

Source§

impl<T> MassLocated for T
where T: CoordinateLike<Mass>,

Source§

impl<T> TimeLocated for T
where T: CoordinateLike<Time>,

Source§

fn time(&self) -> f64

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.