Struct fuel_vm::constraints::CheckedMemConstLen
source · pub struct CheckedMemConstLen<const LEN: usize>(_);
Expand description
A range of memory that has been checked that it fits into the VM memory.
Implementations§
source§impl<const LEN: usize> CheckedMemConstLen<LEN>
impl<const LEN: usize> CheckedMemConstLen<LEN>
sourcepub fn new(address: Word) -> Result<Self, RuntimeError>
pub fn new(address: Word) -> Result<Self, RuntimeError>
Create a new const sized memory range.
Methods from Deref<Target = MemoryRange>§
sourcepub fn shrink_end(&mut self, by: usize)
pub fn shrink_end(&mut self, by: usize)
This function is safe because it is only used to shrink the range and worst case the range will be empty.
sourcepub fn grow_start(&mut self, by: usize)
pub fn grow_start(&mut self, by: usize)
This function is safe because it is only used to grow the range and worst case the range will be empty.
Methods from Deref<Target = Range<usize>>§
1.35.0 · sourcepub fn contains<U>(&self, item: &U) -> boolwhere
Idx: PartialOrd<U>,
U: PartialOrd<Idx> + ?Sized,
pub fn contains<U>(&self, item: &U) -> boolwhere Idx: PartialOrd<U>, U: PartialOrd<Idx> + ?Sized,
Returns true
if item
is contained in the range.
Examples
assert!(!(3..5).contains(&2));
assert!( (3..5).contains(&3));
assert!( (3..5).contains(&4));
assert!(!(3..5).contains(&5));
assert!(!(3..3).contains(&3));
assert!(!(3..2).contains(&3));
assert!( (0.0..1.0).contains(&0.5));
assert!(!(0.0..1.0).contains(&f32::NAN));
assert!(!(0.0..f32::NAN).contains(&0.5));
assert!(!(f32::NAN..1.0).contains(&0.5));
1.47.0 · sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true
if the range contains no items.
Examples
assert!(!(3..5).is_empty());
assert!( (3..3).is_empty());
assert!( (3..2).is_empty());
The range is empty if either side is incomparable:
assert!(!(3.0..5.0).is_empty());
assert!( (3.0..f32::NAN).is_empty());
assert!( (f32::NAN..5.0).is_empty());
Trait Implementations§
source§impl<const LEN: usize> Clone for CheckedMemConstLen<LEN>
impl<const LEN: usize> Clone for CheckedMemConstLen<LEN>
source§fn clone(&self) -> CheckedMemConstLen<LEN>
fn clone(&self) -> CheckedMemConstLen<LEN>
Returns a copy 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<const LEN: usize> Deref for CheckedMemConstLen<LEN>
impl<const LEN: usize> Deref for CheckedMemConstLen<LEN>
Auto Trait Implementations§
impl<const LEN: usize> RefUnwindSafe for CheckedMemConstLen<LEN>
impl<const LEN: usize> Send for CheckedMemConstLen<LEN>
impl<const LEN: usize> Sync for CheckedMemConstLen<LEN>
impl<const LEN: usize> Unpin for CheckedMemConstLen<LEN>
impl<const LEN: usize> UnwindSafe for CheckedMemConstLen<LEN>
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