pub enum RangeConstraint<T> {
GreaterThan(T),
GreaterEqualThan(T),
LessThan(T),
LessEqualThan(T),
Range(T, T),
OneOf(Vec<T>),
Positive,
NonNegative,
Any,
}Expand description
Range constraint for numeric parameters
Variants§
GreaterThan(T)
Parameter must be greater than value
GreaterEqualThan(T)
Parameter must be greater than or equal to value
LessThan(T)
Parameter must be less than value
LessEqualThan(T)
Parameter must be less than or equal to value
Range(T, T)
Parameter must be within inclusive range
OneOf(Vec<T>)
Parameter must be one of specific values
Positive
Parameter must be positive
NonNegative
Parameter must be non-negative
Any
No constraint
Implementations§
Source§impl RangeConstraint<f64>
impl RangeConstraint<f64>
Sourcepub fn validate_f64(&self, value: f64, param_name: &str) -> NeuralResult<()>
pub fn validate_f64(&self, value: f64, param_name: &str) -> NeuralResult<()>
Validate that a value satisfies the constraint (f64 version)
Source§impl RangeConstraint<i64>
impl RangeConstraint<i64>
Sourcepub fn validate_i64(&self, value: i64, param_name: &str) -> NeuralResult<()>
pub fn validate_i64(&self, value: i64, param_name: &str) -> NeuralResult<()>
Validate that a value satisfies the constraint (i64 version)
Trait Implementations§
Source§impl<T: Clone> Clone for RangeConstraint<T>
impl<T: Clone> Clone for RangeConstraint<T>
Source§fn clone(&self) -> RangeConstraint<T>
fn clone(&self) -> RangeConstraint<T>
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<T: Debug> Debug for RangeConstraint<T>
impl<T: Debug> Debug for RangeConstraint<T>
Source§impl<T: PartialEq> PartialEq for RangeConstraint<T>
impl<T: PartialEq> PartialEq for RangeConstraint<T>
impl<T> StructuralPartialEq for RangeConstraint<T>
Auto Trait Implementations§
impl<T> Freeze for RangeConstraint<T>where
T: Freeze,
impl<T> RefUnwindSafe for RangeConstraint<T>where
T: RefUnwindSafe,
impl<T> Send for RangeConstraint<T>where
T: Send,
impl<T> Sync for RangeConstraint<T>where
T: Sync,
impl<T> Unpin for RangeConstraint<T>where
T: Unpin,
impl<T> UnwindSafe for RangeConstraint<T>where
T: UnwindSafe,
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