Enum async_mwmr::Item

source ·
pub enum Item<'a, K, V, B, O> {
    Pending(EntryRef<'a, K, V>),
    Borrowed(B),
    Owned(O),
}
Expand description

An item that is either prefetched or fetched from the database.

Variants§

§

Pending(EntryRef<'a, K, V>)

A pending item, which means that this item is still in a transaction, and not yet commit to the database.

§

Borrowed(B)

An item comes from the database, some db implementation is Copy-on-Write, so this enum varint allows such kind of behavior

§

Owned(O)

An item comes from the database, some db implementation is not Copy-on-Write, so this enum varint allows such kind of behavior

Implementations§

source§

impl<'a, K, V, B, O> Item<'a, K, V, B, O>

source

pub fn unwrap_pending(&self) -> EntryRef<'a, K, V>

Returns the prefetched item.

§Panic

If the item is not prefetched

source

pub fn unwrap_borrow(&self) -> &B

Returns the borrowed item.

§Panic

If the item is not borrowed

source

pub fn unwrap_owned(self) -> O

Returns the owned item.

§Panic

If the item is not owned

source

pub fn unwrap_owned_ref(&self) -> &O

Returns the owned item ref.

§Panic

If the item is not owned

source

pub fn unwrap_committed(self) -> Either<B, O>

Returns the committed item.

§Panic

If the item is not committed

source

pub fn unwrap_committed_ref(&self) -> Either<&B, &O>

Returns the committed item ref.

§Panic

If the item is not committed

Auto Trait Implementations§

§

impl<'a, K, V, B, O> Freeze for Item<'a, K, V, B, O>
where B: Freeze, O: Freeze,

§

impl<'a, K, V, B, O> RefUnwindSafe for Item<'a, K, V, B, O>

§

impl<'a, K, V, B, O> Send for Item<'a, K, V, B, O>
where B: Send, K: Sync, O: Send, V: Sync,

§

impl<'a, K, V, B, O> Sync for Item<'a, K, V, B, O>
where B: Sync, K: Sync, O: Sync, V: Sync,

§

impl<'a, K, V, B, O> Unpin for Item<'a, K, V, B, O>
where B: Unpin, O: Unpin,

§

impl<'a, K, V, B, O> UnwindSafe for Item<'a, K, V, B, O>

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

§

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

§

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.