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>

source

pub fn new(address: Word) -> Result<Self, RuntimeError>

Create a new const sized memory range.

source

pub fn new_with_constraint( address: Word, constraint: Range<Word> ) -> Result<Self, RuntimeError>

Create a new memory range with a custom constraint. Panics if constraints end > VM_MAX_RAM.

source

pub fn read(self, memory: &[u8; 67108864]) -> &[u8; LEN]

Get the memory slice for this range.

source

pub fn write(self, memory: &mut [u8; 67108864]) -> &mut [u8; LEN]

Get the mutable memory slice for this range.

Methods from Deref<Target = CheckedMemRange>§

source

pub fn start(&self) -> usize

The start of the range.

source

pub fn end(&self) -> usize

The end of the range.

source

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.

source

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.

Trait Implementations§

source§

impl<const LEN: usize> Clone for CheckedMemConstLen<LEN>

source§

fn clone(&self) -> CheckedMemConstLen<LEN>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<const LEN: usize> Deref for CheckedMemConstLen<LEN>

§

type Target = CheckedMemRange

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<const LEN: usize> DerefMut for CheckedMemConstLen<LEN>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> StorageAsMut for T

source§

fn storage<Type>(&mut self) -> StorageMut<'_, Self, Type>where Type: Mappable,

source§

fn storage_as_mut<Type>(&mut self) -> StorageMut<'_, Self, Type>where Type: Mappable,

source§

impl<T> StorageAsRef for T

source§

fn storage<Type>(&self) -> StorageRef<'_, Self, Type>where Type: Mappable,

source§

fn storage_as_ref<Type>(&self) -> StorageRef<'_, Self, Type>where Type: Mappable,

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V