pub struct IntegerRange {
pub min: i64,
pub max: i64,
pub step: i64,
}Expand description
Integer range constraints for parameters
Fields§
§min: i64Minimum allowed value (inclusive)
max: i64Maximum allowed value (inclusive)
step: i64Step size for value changes (0 = any step allowed)
Implementations§
Source§impl IntegerRange
impl IntegerRange
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
A range is well-formed when min <= max and step >= 0 (0 = no step).
See FloatingPointRange::is_valid.
Sourcepub fn contains(&self, value: i64) -> bool
pub fn contains(&self, value: i64) -> bool
Check if a value is within this range.
Issue 1150: step is ENFORCED, mirroring rclrs range.rs: in range
iff min <= v <= max and, when step != 0, (v - min) is a multiple
of step. The upper bound is always accepted even when off-lattice,
exactly as upstream. Arithmetic is checked so an extreme min cannot
overflow into a panic.
Trait Implementations§
Source§impl Clone for IntegerRange
impl Clone for IntegerRange
Source§fn clone(&self) -> IntegerRange
fn clone(&self) -> IntegerRange
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for IntegerRange
Source§impl Debug for IntegerRange
impl Debug for IntegerRange
Source§impl Default for IntegerRange
impl Default for IntegerRange
Source§fn default() -> IntegerRange
fn default() -> IntegerRange
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for IntegerRange
impl RefUnwindSafe for IntegerRange
impl Send for IntegerRange
impl Sync for IntegerRange
impl Unpin for IntegerRange
impl UnsafeUnpin for IntegerRange
impl UnwindSafe for IntegerRange
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