Skip to main content

AutoincrementLedger

Struct AutoincrementLedger 

Source
pub struct AutoincrementLedger { /* private fields */ }
Expand description

Ledger for autoincrement values, used by tables with autoincrement columns.

Implementations§

Source§

impl AutoincrementLedger

Source

pub fn init<TS>(page: Page, mm: &mut impl MemoryAccess) -> MemoryResult<Self>
where TS: TableSchema,

Initialize the AutoincrementLedger for the given table schema, and write it to the given page.

Each autoincrement column in the table schema will be initialized in the registry with the appropriate zero value.

Source

pub fn load(page: Page, mm: &mut impl MemoryAccess) -> MemoryResult<Self>

Load the AutoincrementLedger from the given page.

Source

pub fn next( &mut self, column: &str, mm: &mut impl MemoryAccess, ) -> MemoryResult<Value>

Returns the next autoincrement Value for the given column, and persists the updated registry to memory.

§Errors

Returns [MemoryError::AutoincrementOverflow] if the column has reached its maximum value.

Trait Implementations§

Source§

impl Debug for AutoincrementLedger

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<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.