pub struct GearPage(/* private fields */);Expand description
Page number.
Trait Implementations§
source§impl Decode for GearPage
impl Decode for GearPage
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 GearPage
impl Encode for GearPage
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 GearPage
impl Ord for GearPage
source§impl PageDynSize for GearPage
impl PageDynSize for GearPage
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 GearPage
impl PageNumber for GearPage
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 GearPage
impl PageU32Size for GearPage
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..=selfsource§fn iter_from_zero(&self) -> PagesIter<Self> ⓘ
fn iter_from_zero(&self) -> PagesIter<Self> ⓘ
Returns iterator
0..selfsource§fn iter_once(&self) -> PagesIterInclusive<Self> ⓘ
fn iter_once(&self) -> PagesIterInclusive<Self> ⓘ
Returns iterator
self..=selfsource§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 GearPage
impl PartialEq for GearPage
source§impl PartialOrd for GearPage
impl PartialOrd for GearPage
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 GearPage
impl EncodeLike for GearPage
impl Eq for GearPage
impl StructuralPartialEq for GearPage
Auto Trait Implementations§
impl Freeze for GearPage
impl RefUnwindSafe for GearPage
impl Send for GearPage
impl Sync for GearPage
impl Unpin for GearPage
impl UnwindSafe for GearPage
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