Struct audio_processor_testing_helpers::charts::Linspace
source · [−]pub struct Linspace<T, S, R> where
T: Ranged,
S: Clone,
R: LinspaceRoundingMethod<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Add<S>,
<T as Ranged>::ValueType: PartialOrd<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Clone,
<<T as Ranged>::ValueType as Add<S>>::Output == <T as Ranged>::ValueType, { /* private fields */ }
Expand description
The coordinate combinator that transform a continous coordinate to a discrete coordinate to a discrete coordinate by a giving step.
For example, range 0f32..100f32
is a continuous coordinate, thus this prevent us having a
histogram on it since Plotters doesn’t know how to segment the range into buckets.
In this case, to get a histogram, we need to split the original range to a
set of discrete buckets (for example, 0.5 per bucket).
The linspace decorate abstracting this method. For example, we can have a discrete coordinate:
(0f32..100f32).step(0.5)
.
Linspace also supports different types of bucket matching method - This configuration alters the behavior of DiscreteCoord::index_of for Linspace coord spec
- Flooring, the value falls into the nearst bucket smaller than it. See Linspace::use_floor
- Round, the value falls into the nearst bucket. See Linearspace::use_round
- Ceiling, the value falls into the nearst bucket larger than itself. See Linspace::use_ceil
- Exact Matchting, the value must be exactly same as the butcket value. See Linspace::use_exact
Implementations
sourceimpl<T, S, R> Linspace<T, S, R> where
T: Ranged,
S: Clone,
R: LinspaceRoundingMethod<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Add<S>,
<T as Ranged>::ValueType: PartialOrd<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Clone,
<<T as Ranged>::ValueType as Add<S>>::Output == <T as Ranged>::ValueType,
impl<T, S, R> Linspace<T, S, R> where
T: Ranged,
S: Clone,
R: LinspaceRoundingMethod<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Add<S>,
<T as Ranged>::ValueType: PartialOrd<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Clone,
<<T as Ranged>::ValueType as Add<S>>::Output == <T as Ranged>::ValueType,
sourcepub fn use_ceil(self) -> Linspace<T, S, Ceil<<T as Ranged>::ValueType>>
pub fn use_ceil(self) -> Linspace<T, S, Ceil<<T as Ranged>::ValueType>>
Set the linspace use the round up method for value matching
- returns: The newly created linspace that uses new matching method
sourcepub fn use_floor(self) -> Linspace<T, S, Floor<<T as Ranged>::ValueType>>
pub fn use_floor(self) -> Linspace<T, S, Floor<<T as Ranged>::ValueType>>
Set the linspace use the round down method for value matching
- returns: The newly created linspace that uses new matching method
sourcepub fn use_round(self) -> Linspace<T, S, Round<<T as Ranged>::ValueType, S>> where
S: PartialOrd<S>,
<T as Ranged>::ValueType: Sub<<T as Ranged>::ValueType>,
<<T as Ranged>::ValueType as Sub<<T as Ranged>::ValueType>>::Output == S,
pub fn use_round(self) -> Linspace<T, S, Round<<T as Ranged>::ValueType, S>> where
S: PartialOrd<S>,
<T as Ranged>::ValueType: Sub<<T as Ranged>::ValueType>,
<<T as Ranged>::ValueType as Sub<<T as Ranged>::ValueType>>::Output == S,
Set the linspace use the best match method for value matching
- returns: The newly created linspace that uses new matching method
sourcepub fn use_exact(self) -> Linspace<T, S, Exact<<T as Ranged>::ValueType>> where
S: PartialOrd<S>,
<T as Ranged>::ValueType: Sub<<T as Ranged>::ValueType>,
<<T as Ranged>::ValueType as Sub<<T as Ranged>::ValueType>>::Output == S,
pub fn use_exact(self) -> Linspace<T, S, Exact<<T as Ranged>::ValueType>> where
S: PartialOrd<S>,
<T as Ranged>::ValueType: Sub<<T as Ranged>::ValueType>,
<<T as Ranged>::ValueType as Sub<<T as Ranged>::ValueType>>::Output == S,
Set the linspace use the exact match method for value matching
- returns: The newly created linspace that uses new matching method
Trait Implementations
sourceimpl<T, S, R> Clone for Linspace<T, S, R> where
T: Clone + Ranged,
S: Clone,
R: Clone + LinspaceRoundingMethod<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Add<S>,
<T as Ranged>::ValueType: PartialOrd<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Clone,
<T as Ranged>::ValueType: Clone,
<<T as Ranged>::ValueType as Add<S>>::Output == <T as Ranged>::ValueType,
impl<T, S, R> Clone for Linspace<T, S, R> where
T: Clone + Ranged,
S: Clone,
R: Clone + LinspaceRoundingMethod<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Add<S>,
<T as Ranged>::ValueType: PartialOrd<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Clone,
<T as Ranged>::ValueType: Clone,
<<T as Ranged>::ValueType as Add<S>>::Output == <T as Ranged>::ValueType,
sourceimpl<T, S, R> DiscreteRanged for Linspace<T, S, R> where
T: Ranged,
S: Clone,
R: LinspaceRoundingMethod<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Add<S>,
<T as Ranged>::ValueType: PartialOrd<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Clone,
<<T as Ranged>::ValueType as Add<S>>::Output == <T as Ranged>::ValueType,
impl<T, S, R> DiscreteRanged for Linspace<T, S, R> where
T: Ranged,
S: Clone,
R: LinspaceRoundingMethod<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Add<S>,
<T as Ranged>::ValueType: PartialOrd<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Clone,
<<T as Ranged>::ValueType as Add<S>>::Output == <T as Ranged>::ValueType,
sourcefn size(&self) -> usize
fn size(&self) -> usize
Get the number of element in the range Note: we assume that all the ranged discrete coordinate has finite value Read more
sourcefn index_of(&self, value: &<T as Ranged>::ValueType) -> Option<usize>
fn index_of(&self, value: &<T as Ranged>::ValueType) -> Option<usize>
Map a value to the index Read more
sourcefn from_index(&self, idx: usize) -> Option<<T as Ranged>::ValueType>
fn from_index(&self, idx: usize) -> Option<<T as Ranged>::ValueType>
Reverse map the index to the value Read more
sourcefn values(&self) -> DiscreteValueIter<'_, Self>
fn values(&self) -> DiscreteValueIter<'_, Self>
Return a iterator that iterates over the all possible values Read more
sourceimpl<T, S, R> Ranged for Linspace<T, S, R> where
T: Ranged,
S: Clone,
R: LinspaceRoundingMethod<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Add<S>,
<T as Ranged>::ValueType: PartialOrd<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Clone,
<<T as Ranged>::ValueType as Add<S>>::Output == <T as Ranged>::ValueType,
impl<T, S, R> Ranged for Linspace<T, S, R> where
T: Ranged,
S: Clone,
R: LinspaceRoundingMethod<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Add<S>,
<T as Ranged>::ValueType: PartialOrd<<T as Ranged>::ValueType>,
<T as Ranged>::ValueType: Clone,
<<T as Ranged>::ValueType as Add<S>>::Output == <T as Ranged>::ValueType,
type FormatOption = NoDefaultFormatting
type FormatOption = NoDefaultFormatting
This marker decides if Plotters default ValueFormatter implementation should be used. This assicated type can be one of follow two types: Read more
sourcefn map(&self, value: &<T as Ranged>::ValueType, limit: (i32, i32)) -> i32
fn map(&self, value: &<T as Ranged>::ValueType, limit: (i32, i32)) -> i32
This function maps the value to i32, which is the drawing coordinate
sourcefn key_points<Hint>(&self, hint: Hint) -> Vec<<T as Ranged>::ValueType, Global> where
Hint: KeyPointHint,
fn key_points<Hint>(&self, hint: Hint) -> Vec<<T as Ranged>::ValueType, Global> where
Hint: KeyPointHint,
This function gives the key points that we can draw a grid based on this
sourceimpl<T, R, S, RM> ValueFormatter<T> for Linspace<R, S, RM> where
R: Ranged<ValueType = T> + ValueFormatter<T>,
RM: LinspaceRoundingMethod<T>,
T: Add<S, Output = T> + PartialOrd<T> + Clone,
S: Clone,
impl<T, R, S, RM> ValueFormatter<T> for Linspace<R, S, RM> where
R: Ranged<ValueType = T> + ValueFormatter<T>,
RM: LinspaceRoundingMethod<T>,
T: Add<S, Output = T> + PartialOrd<T> + Clone,
S: Clone,
Auto Trait Implementations
impl<T, S, R> RefUnwindSafe for Linspace<T, S, R> where
R: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
<T as Ranged>::ValueType: RefUnwindSafe,
impl<T, S, R> Send for Linspace<T, S, R> where
R: Send,
S: Send,
T: Send,
<T as Ranged>::ValueType: Send,
impl<T, S, R> Sync for Linspace<T, S, R> where
R: Sync,
S: Sync,
T: Sync,
<T as Ranged>::ValueType: Sync,
impl<T, S, R> Unpin for Linspace<T, S, R> where
R: Unpin,
S: Unpin,
T: Unpin,
<T as Ranged>::ValueType: Unpin,
impl<T, S, R> UnwindSafe for Linspace<T, S, R> where
R: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
<T as Ranged>::ValueType: UnwindSafe,
Blanket Implementations
sourceimpl<T> AsRangedCoord for T where
T: Ranged,
impl<T> AsRangedCoord for T where
T: Ranged,
type CoordDescType = T
type Value = <T as Ranged>::ValueType
sourceimpl<T> BindKeyPointMethod for T where
T: AsRangedCoord,
impl<T> BindKeyPointMethod for T where
T: AsRangedCoord,
sourcefn with_key_point_func<F>(
self,
func: F
) -> WithKeyPointMethod<Self::CoordDescType> where
F: 'static + Fn(usize) -> Vec<Self::Value, Global>,
fn with_key_point_func<F>(
self,
func: F
) -> WithKeyPointMethod<Self::CoordDescType> where
F: 'static + Fn(usize) -> Vec<Self::Value, Global>,
Bind a existing coordinate spec with a given key points algorithm. See WithKeyPointMethod for more details. Example: Read more
sourceimpl<T> BindKeyPoints for T where
T: AsRangedCoord,
impl<T> BindKeyPoints for T where
T: AsRangedCoord,
sourcefn with_key_points(
self,
points: Vec<Self::Value, Global>
) -> WithKeyPoints<Self::CoordDescType>
fn with_key_points(
self,
points: Vec<Self::Value, Global>
) -> WithKeyPoints<Self::CoordDescType>
Bind a existing coordinate spec with a given key points vector. See WithKeyPoints for more details. Example: Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> IntoLinspace for T where
T: AsRangedCoord,
impl<T> IntoLinspace for T where
T: AsRangedCoord,
sourcefn step<S>(self, val: S) -> Linspace<Self::CoordDescType, S, Exact<Self::Value>> where
S: Clone,
Self::Value: Add<S>,
Self::Value: PartialOrd<Self::Value>,
Self::Value: Clone,
<Self::Value as Add<S>>::Output == Self::Value,
fn step<S>(self, val: S) -> Linspace<Self::CoordDescType, S, Exact<Self::Value>> where
S: Clone,
Self::Value: Add<S>,
Self::Value: PartialOrd<Self::Value>,
Self::Value: Clone,
<Self::Value as Add<S>>::Output == Self::Value,
Set the step value, make a linspace coordinate from the given range. By default the matching method use the exact match Read more
sourceimpl<R> IntoPartialAxis for R where
R: AsRangedCoord,
impl<R> IntoPartialAxis for R where
R: AsRangedCoord,
sourcefn partial_axis(
self,
axis_range: Range<<Self::CoordDescType as Ranged>::ValueType>
) -> PartialAxis<Self::CoordDescType>
fn partial_axis(
self,
axis_range: Range<<Self::CoordDescType as Ranged>::ValueType>
) -> PartialAxis<Self::CoordDescType>
Make the partial axis Read more
sourceimpl<DC> ReversibleRanged for DC where
DC: DiscreteRanged,
impl<DC> ReversibleRanged for DC where
DC: DiscreteRanged,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more