pub struct FallbackConfig {
pub nan_replacement: f64,
pub pos_inf_replacement: f64,
pub neg_inf_replacement: f64,
pub fail_on_nan: bool,
pub fail_on_inf: bool,
pub min_value: Option<f64>,
pub max_value: Option<f64>,
}Expand description
Configuration for fallback behavior
Fields§
§nan_replacement: f64Replace NaN with this value
pos_inf_replacement: f64Replace positive infinity with this value
neg_inf_replacement: f64Replace negative infinity with this value
fail_on_nan: boolWhether to fail on NaN (if false, replace)
fail_on_inf: boolWhether to fail on Inf (if false, replace)
min_value: Option<f64>Minimum value (clamp below this)
max_value: Option<f64>Maximum value (clamp above this)
Implementations§
Source§impl FallbackConfig
impl FallbackConfig
Sourcepub fn permissive() -> Self
pub fn permissive() -> Self
Create a permissive config that replaces all invalid values
Sourcepub fn with_nan_replacement(self, value: f64) -> Self
pub fn with_nan_replacement(self, value: f64) -> Self
Set NaN replacement value
Sourcepub fn with_inf_replacement(self, pos: f64, neg: f64) -> Self
pub fn with_inf_replacement(self, pos: f64, neg: f64) -> Self
Set infinity replacement values
Sourcepub fn with_clamp(self, min: f64, max: f64) -> Self
pub fn with_clamp(self, min: f64, max: f64) -> Self
Set value clamping range
Trait Implementations§
Source§impl Clone for FallbackConfig
impl Clone for FallbackConfig
Source§fn clone(&self) -> FallbackConfig
fn clone(&self) -> FallbackConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FallbackConfig
impl Debug for FallbackConfig
Auto Trait Implementations§
impl Freeze for FallbackConfig
impl RefUnwindSafe for FallbackConfig
impl Send for FallbackConfig
impl Sync for FallbackConfig
impl Unpin for FallbackConfig
impl UnwindSafe for FallbackConfig
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<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 more