pub struct WasmPage(/* private fields */);
Expand description
Wasm page number.
Trait Implementations§
source§impl Decode for WasmPage
impl Decode for WasmPage
source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy ) -> Result<Self, Error>
Attempt to deserialise the value from input.
source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>where
I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
source§impl Encode for WasmPage
impl Encode for WasmPage
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy )
Convert self to a slice and append it to the destination.
source§fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>(
&self,
f: __CodecUsingEncodedCallback
) -> __CodecOutputReturn
fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>( &self, f: __CodecUsingEncodedCallback ) -> __CodecOutputReturn
Convert self to a slice and then invoke the given closure with it.
source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
source§impl Ord for WasmPage
impl Ord for WasmPage
source§impl PageDynSize for WasmPage
impl PageDynSize for WasmPage
source§fn new<S: SizeManager>(raw: u32, ctx: &S) -> Option<Self>
fn new<S: SizeManager>(raw: u32, ctx: &S) -> Option<Self>
Creates page from raw number with specific context and checks that page number is valid.
Returns None if page number is invalid.
source§fn end_offset<S: SizeManager>(&self, ctx: &S) -> u32
fn end_offset<S: SizeManager>(&self, ctx: &S) -> u32
Returns offset of end of page.
source§fn from_offset<S: SizeManager>(ctx: &S, offset: u32) -> Self
fn from_offset<S: SizeManager>(ctx: &S, offset: u32) -> Self
Creates page from offset.
source§impl PageNumber for WasmPage
impl PageNumber for WasmPage
source§fn checked_sub(&self, other: Self) -> Option<Self>
fn checked_sub(&self, other: Self) -> Option<Self>
Checked subtraction.
source§fn iter_end_inclusive(
&self,
end: Self
) -> Result<PagesIterInclusive<Self>, PageError>
fn iter_end_inclusive( &self, end: Self ) -> Result<PagesIterInclusive<Self>, PageError>
Returns iterator
self
..=end
.source§impl PageU32Size for WasmPage
impl PageU32Size for WasmPage
source§fn size_non_zero() -> NonZeroU32
fn size_non_zero() -> NonZeroU32
Returns size of page.
source§unsafe fn new_unchecked(num: u32) -> Self
unsafe fn new_unchecked(num: u32) -> Self
Constructs new page without any checks. Read more
source§fn from_offset(offset: u32) -> Self
fn from_offset(offset: u32) -> Self
Constructs new page from byte offset: returns page which contains this byte.
source§fn new(num: u32) -> Result<Self, PageError>
fn new(num: u32) -> Result<Self, PageError>
Constructs new page from raw page number with checks.
Returns error if page will contain bytes, with offsets bigger then u32::MAX.
source§fn end_offset(&self) -> u32
fn end_offset(&self) -> u32
Returns page last byte offset.
source§fn to_page<P1: PageU32Size>(&self) -> P1
fn to_page<P1: PageU32Size>(&self) -> P1
Returns new page, which contains
self
zero byte.source§fn to_last_page<P1: PageU32Size>(&self) -> P1
fn to_last_page<P1: PageU32Size>(&self) -> P1
Returns new page, which contains
self
last byte.source§fn add_raw(&self, raw: u32) -> Result<Self, PageError>
fn add_raw(&self, raw: u32) -> Result<Self, PageError>
Returns page which has number
page.raw() + raw
, with checks.source§fn sub_raw(&self, raw: u32) -> Result<Self, PageError>
fn sub_raw(&self, raw: u32) -> Result<Self, PageError>
Returns page which has number
page.raw() - raw
, with checks.source§fn add(&self, other: Self) -> Result<Self, PageError>
fn add(&self, other: Self) -> Result<Self, PageError>
Returns page which has number
page.raw() + other.raw()
, with checks.source§fn sub(&self, other: Self) -> Result<Self, PageError>
fn sub(&self, other: Self) -> Result<Self, PageError>
Returns page which has number
page.raw() - other.raw()
, with checks.source§fn inc(&self) -> Result<Self, PageError>
fn inc(&self) -> Result<Self, PageError>
Returns page which has number
page.raw() + 1
, with checks.source§fn dec(&self) -> Result<Self, PageError>
fn dec(&self) -> Result<Self, PageError>
Returns page which has number
page.raw() - 1
, with checks.source§fn align_down(&self, size: NonZeroU32) -> Self
fn align_down(&self, size: NonZeroU32) -> Self
Aligns page zero byte and returns page which contains this byte.
Normally if
size % Self::size() == 0
,
then aligned byte is zero byte of the returned page.source§fn iter_count(&self, count: Self) -> Result<PagesIter<Self>, PageError>
fn iter_count(&self, count: Self) -> Result<PagesIter<Self>, PageError>
Returns iterator
self
..self
+ count
.source§fn iter_end(&self, end: Self) -> Result<PagesIter<Self>, PageError>
fn iter_end(&self, end: Self) -> Result<PagesIter<Self>, PageError>
Returns iterator
self
..end
.source§fn iter_from_zero_inclusive(&self) -> PagesIterInclusive<Self> ⓘ
fn iter_from_zero_inclusive(&self) -> PagesIterInclusive<Self> ⓘ
Returns iterator
0
..=self
source§fn iter_from_zero(&self) -> PagesIter<Self> ⓘ
fn iter_from_zero(&self) -> PagesIter<Self> ⓘ
Returns iterator
0
..self
source§fn iter_once(&self) -> PagesIterInclusive<Self> ⓘ
fn iter_once(&self) -> PagesIterInclusive<Self> ⓘ
Returns iterator
self
..=self
source§fn to_pages_iter<P: PageU32Size>(&self) -> PagesIterInclusive<P> ⓘ
fn to_pages_iter<P: PageU32Size>(&self) -> PagesIterInclusive<P> ⓘ
Returns an iterator that iterates over the range of pages from
self
to the end page,
inclusive. Each iteration yields a page of type P
. Read moresource§impl PartialEq for WasmPage
impl PartialEq for WasmPage
source§impl PartialOrd for WasmPage
impl PartialOrd for WasmPage
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for WasmPage
impl EncodeLike for WasmPage
impl Eq for WasmPage
impl StructuralEq for WasmPage
impl StructuralPartialEq for WasmPage
Auto Trait Implementations§
impl RefUnwindSafe for WasmPage
impl Send for WasmPage
impl Sync for WasmPage
impl Unpin for WasmPage
impl UnwindSafe for WasmPage
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