pub struct Params {
pub gain: Option<f64>,
pub offset: Option<f64>,
pub residuals: Option<f64>,
pub power: Option<f64>,
pub base: Option<f64>,
}
Expand description
A structure to hold function parameters
Function examples:
f(x) = gain * x + offset
f(x) = gain * x ^ power
f(x) = gain * base ^ x
§Example
let params = big_o::Params::new().gain(2.0).offset(3.0).build();
assert_eq!(params.gain, Some(2.0));
assert_eq!(params.offset, Some(3.0));
assert_eq!(params.power, None);
Fields§
§gain: Option<f64>
§offset: Option<f64>
§residuals: Option<f64>
§power: Option<f64>
§base: Option<f64>
Implementations§
Source§impl Params
Params builder
impl Params
Params builder
pub fn new() -> Self
pub fn gain(&mut self, value: f64) -> &mut Self
pub fn offset(&mut self, value: f64) -> &mut Self
pub fn residuals(&mut self, value: f64) -> &mut Self
pub fn power(&mut self, value: f64) -> &mut Self
pub fn base(&mut self, value: f64) -> &mut Self
pub fn build(&mut self) -> Params
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Params
impl RefUnwindSafe for Params
impl Send for Params
impl Sync for Params
impl Unpin for Params
impl UnwindSafe for Params
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.