pub struct Bound(/* private fields */);Expand description
A newtype wrapper around an optional float, with convenience methods to specify an infinite-fallback.
Bounds are used to represent constraint values that can either be finite numbers or positive/negative infinity. When serialized, infinite values are represented as null for cleaner API responses and requests.
Implementations§
Source§impl Bound
impl Bound
Sourcepub fn or_pos_inf(&self) -> f64
pub fn or_pos_inf(&self) -> f64
Returns the contained value or positive infinity if None
This is typically used for upper bounds where no limit means infinity.
Sourcepub fn or_neg_inf(&self) -> f64
pub fn or_neg_inf(&self) -> f64
Returns the contained value or negative infinity if None
This is typically used for lower bounds where no limit means negative infinity.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Bound
impl<'de> Deserialize<'de> for Bound
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Bound
impl RefUnwindSafe for Bound
impl Send for Bound
impl Sync for Bound
impl Unpin for Bound
impl UnwindSafe for Bound
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