pub struct Blob<T: Decode> {
pub contents: Lazy<T>,
}
Expand description
A length-prefixed blob that can be skipped over during decoding.
Fields§
§contents: Lazy<T>
Lazily-decoded contents of the blob.
Methods from Deref<Target = Lazy<T>>§
sourcepub fn try_as_raw(&self) -> Result<&UnparsedBytes, &T>
pub fn try_as_raw(&self) -> Result<&UnparsedBytes, &T>
Retrieve the raw bytes if the value has not been modified yet.
sourcepub fn try_contents(&self) -> Result<&T, DecodeError>
pub fn try_contents(&self) -> Result<&T, DecodeError>
Retrieve a reference to the inner value, decoding it if it wasn’t already.
sourcepub fn try_contents_mut(&mut self) -> Result<&mut T, DecodeError>
pub fn try_contents_mut(&mut self) -> Result<&mut T, DecodeError>
Retrieve a mutable reference to the inner value, decoding it if it wasn’t already.
This will invalidate the original raw bytes.
Trait Implementations§
source§impl From<Blob<Vec<Exception>>> for Section
Available on crate feature exception-handling
only.
impl From<Blob<Vec<Exception>>> for Section
Available on crate feature
exception-handling
only.source§impl<T: PartialEq + Decode> PartialEq for Blob<T>
impl<T: PartialEq + Decode> PartialEq for Blob<T>
source§impl<T> Visit for Blob<T>
impl<T> Visit for Blob<T>
source§fn visit_children<'a, VisitT: 'static, VisitE, VisitF: FnMut(&'a VisitT) -> Result<(), VisitE>>(
&'a self,
f: &mut VisitF
) -> Result<(), VisitError<VisitE>>
fn visit_children<'a, VisitT: 'static, VisitE, VisitF: FnMut(&'a VisitT) -> Result<(), VisitE>>( &'a self, f: &mut VisitF ) -> Result<(), VisitError<VisitE>>
Traverse the children of this value with the provided callback.
source§fn visit_children_mut<VisitT: 'static, VisitE, VisitF: FnMut(&mut VisitT) -> Result<(), VisitE>>(
&mut self,
f: &mut VisitF
) -> Result<(), VisitError<VisitE>>
fn visit_children_mut<VisitT: 'static, VisitE, VisitF: FnMut(&mut VisitT) -> Result<(), VisitE>>( &mut self, f: &mut VisitF ) -> Result<(), VisitError<VisitE>>
Traverse the children of this value mutably with the provided callback.
source§fn visit<'a, T: 'static, R: VisitResult, F: FnMut(&'a T) -> R>(
&'a self,
f: F
) -> Result<(), VisitError<R::Error>>
fn visit<'a, T: 'static, R: VisitResult, F: FnMut(&'a T) -> R>( &'a self, f: F ) -> Result<(), VisitError<R::Error>>
Traverse this value with the provided callback.
source§fn visit_mut<T: 'static, R: VisitResult, F: FnMut(&mut T) -> R>(
&mut self,
f: F
) -> Result<(), VisitError<R::Error>>
fn visit_mut<T: 'static, R: VisitResult, F: FnMut(&mut T) -> R>( &mut self, f: F ) -> Result<(), VisitError<R::Error>>
Traverse this value mutably with the provided callback.
impl<T: Eq + Decode> Eq for Blob<T>
impl<T: Decode> StructuralEq for Blob<T>
impl<T: Decode> StructuralPartialEq for Blob<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Blob<T>where
T: UnwindSafe + RefUnwindSafe,
impl<T> Send for Blob<T>where
T: Send,
impl<T> Sync for Blob<T>
impl<T> Unpin for Blob<T>where
T: Unpin,
impl<T> UnwindSafe for Blob<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more