pub struct PiecewiseLinearFunctionBuilder {
largest_x: Option<CSSFloat>,
smallest_x: Option<CSSFloat>,
entries: Vec<BuildEntry>,
}
Expand description
Builder object to generate a linear function.
Fields§
§largest_x: Option<CSSFloat>
§smallest_x: Option<CSSFloat>
§entries: Vec<BuildEntry>
Implementations§
source§impl PiecewiseLinearFunctionBuilder
impl PiecewiseLinearFunctionBuilder
sourcepub fn with_capacity(len: usize) -> Self
pub fn with_capacity(len: usize) -> Self
Create a builder for a known amount of linear stop entries.
fn create_entry(&mut self, y: CSSFloat, x: Option<CSSFloat>)
sourcepub fn push(&mut self, y: CSSFloat, x_start: Option<CSSFloat>)
pub fn push(&mut self, y: CSSFloat, x_start: Option<CSSFloat>)
Add a new entry into the piecewise linear function with specified y value. If the start x value is given, that is where the x value will be. Otherwise, the x value is calculated later. If the end x value is specified, a flat segment is generated. If start x value is not specified but end x is, it is treated as start x.
sourcepub fn build(self) -> PiecewiseLinearFunction
pub fn build(self) -> PiecewiseLinearFunction
Finish building the piecewise linear function by resolving all undefined x values, then return the result.
Trait Implementations§
source§impl Default for PiecewiseLinearFunctionBuilder
impl Default for PiecewiseLinearFunctionBuilder
source§fn default() -> PiecewiseLinearFunctionBuilder
fn default() -> PiecewiseLinearFunctionBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PiecewiseLinearFunctionBuilder
impl RefUnwindSafe for PiecewiseLinearFunctionBuilder
impl Send for PiecewiseLinearFunctionBuilder
impl Sync for PiecewiseLinearFunctionBuilder
impl Unpin for PiecewiseLinearFunctionBuilder
impl UnwindSafe for PiecewiseLinearFunctionBuilder
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert