[−][src]Enum canonical::Repr
A Repr to a value that is either local or in storage
Variants
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
Value is represented by it's Identifier
Fields of Ident
Implementations
impl<T, S> Repr<T, S> where
S: Store,
T: Canon<S> + Clone,
[src]
S: Store,
T: Canon<S> + Clone,
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]
S: Store,
T: Canon<S>,
pub fn write(&self, sink: &mut impl Sink<S>) -> Result<(), S::Error>
[src]
pub fn read(source: &mut impl Source<S>) -> Result<Self, S::Error>
[src]
pub fn encoded_len(&self) -> usize
[src]
impl<T: Clone, S: Clone + Store> Clone for Repr<T, S> where
S::Ident: Clone,
S::Ident: Clone,
[src]
S::Ident: Clone,
S::Ident: Clone,
pub fn clone(&self) -> Repr<T, S>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug, S: Debug + Store> Debug for Repr<T, S> where
S::Ident: Debug,
S::Ident: Debug,
[src]
S::Ident: Debug,
S::Ident: Debug,
Auto Trait Implementations
impl<T, S> Send for Repr<T, S> where
S: Send,
T: Send,
<S as Store>::Ident: Send,
[src]
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,
[src]
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,
[src]
S: Unpin,
T: Unpin,
<S as Store>::Ident: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,