Enum canonical::Repr[][src]

pub enum Repr<T, S: Store> {
    Inline {
        bytes: S::Ident,
        len: u8,
        _marker: PhantomData<T>,
    },
    Ident {
        ident: S::Ident,
        store: S,
    },
}

A Repr to a value that is either local or in storage

Variants

Inline

Value is stored inline as bytes

Fields of Inline

bytes: S::Ident

Thy bytes of the ident is used for the encoded value

len: u8

The length of the encoded value

_marker: PhantomData<T>

Type of the represented type

Ident

Value is represented by it’s Identifier

Fields of Ident

ident: S::Ident

The value identifier

store: S

The store where to request the value

Implementations

impl<T, S> Repr<T, S> where
    S: Store,
    T: Canon<S> + Clone
[src]

pub fn new(t: T) -> Self[src]

Construct a new Repr from value t

pub fn restore(&self) -> Result<T, S::Error>[src]

Returns the value behind the Repr

pub fn val(&self) -> Result<Val<'_, T>, S::Error>[src]

Retrieve the value behind this representation

pub fn val_mut(&mut self) -> Result<ValMut<'_, T, S>, S::Error>[src]

Retrieve a mutable value behind this representation

pub fn unwrap_or_clone(self) -> Result<T, S::Error>[src]

Unwrap or clone the contained item

pub fn get_id(&self) -> S::Ident[src]

Get the identifier for the Repr

Trait Implementations

impl<T, S> Canon<S> for Repr<T, S> where
    S: Store,
    T: Canon<S>, 
[src]

impl<T: Clone, S: Clone + Store> Clone for Repr<T, S> where
    S::Ident: Clone,
    S::Ident: Clone
[src]

impl<T: Debug, S: Debug + Store> Debug for Repr<T, S> where
    S::Ident: Debug,
    S::Ident: Debug
[src]

Auto Trait Implementations

impl<T, S> RefUnwindSafe for Repr<T, S> where
    S: RefUnwindSafe,
    T: RefUnwindSafe,
    <S as Store>::Ident: RefUnwindSafe

impl<T, S> Send for Repr<T, S> where
    S: Send,
    T: Send,
    <S as Store>::Ident: Send

impl<T, S> Sync for Repr<T, S> where
    S: Sync,
    T: Sync,
    <S as Store>::Ident: Sync

impl<T, S> Unpin for Repr<T, S> where
    S: Unpin,
    T: Unpin,
    <S as Store>::Ident: Unpin

impl<T, S> UnwindSafe for Repr<T, S> where
    S: UnwindSafe,
    T: UnwindSafe,
    <S as Store>::Ident: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.