Skip to main content

PageMut

Struct PageMut 

Source
pub struct PageMut<'a> { /* private fields */ }
Expand description

An exclusive write borrow of a pinned page. Dereferences to Page.

Methods from Deref<Target = Page>§

Source

pub fn page_size(&self) -> usize

The page size in bytes.

Source

pub fn id(&self) -> PageId

The id stamped in the header. For a page from Page::new this is 0 until the page is written to a slot.

Source

pub fn lsn(&self) -> Lsn

The log sequence number stamped in the header.

Source

pub fn set_lsn(&mut self, lsn: Lsn)

Set the log sequence number. Takes effect in the checksum the next time the page is stamped (on PageFile::write_page).

Source

pub fn payload(&self) -> &[u8]

The payload — the page bytes after the header.

Source

pub fn payload_mut(&mut self) -> &mut [u8]

The payload, mutably.

Source

pub fn to_checksummed_bytes(&self) -> Vec<u8>

The whole page as a checksummed byte block, ready to persist elsewhere.

The returned vector is page_size bytes with a freshly computed checksum in the header; feed it back through Page::from_bytes to recover and verify the page. The stamped id is left untouched (0 unless the page came from a file).

Trait Implementations§

Source§

impl Deref for PageMut<'_>

Source§

type Target = Page

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Page

Dereferences the value.
Source§

impl DerefMut for PageMut<'_>

Source§

fn deref_mut(&mut self) -> &mut Page

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a> !Send for PageMut<'a>

§

impl<'a> Freeze for PageMut<'a>

§

impl<'a> RefUnwindSafe for PageMut<'a>

§

impl<'a> Sync for PageMut<'a>

§

impl<'a> Unpin for PageMut<'a>

§

impl<'a> UnsafeUnpin for PageMut<'a>

§

impl<'a> UnwindSafe for PageMut<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.