pub struct RangeCfg { /* private fields */ }
Expand description
Configuration for limiting the range of a usize value.
This is often used to configure length limits for variable-length types or collections.
§Example
use commonware_codec::RangeCfg;
// Limit lengths to 0..=1024
let cfg = RangeCfg::from(0..=1024);
assert!(cfg.contains(&500));
assert!(!cfg.contains(&2000));
// Allow any length >= 1
let cfg_min = RangeCfg::from(1..);
assert!(cfg_min.contains(&1));
assert!(!cfg_min.contains(&0));
Implementations§
Trait Implementations§
impl Copy for RangeCfg
impl Eq for RangeCfg
impl StructuralPartialEq for RangeCfg
Auto Trait Implementations§
impl Freeze for RangeCfg
impl RefUnwindSafe for RangeCfg
impl Send for RangeCfg
impl Sync for RangeCfg
impl Unpin for RangeCfg
impl UnwindSafe for RangeCfg
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