Struct datacake_rpc::DataView
source · pub struct DataView<T, D = AlignedVec>where
T: Archive,
T::Archived: 'static,
D: Deref<Target = [u8]> + Send + Sync,{ /* private fields */ }Expand description
A block of data that can be accessed as if it is the archived value T.
This allows for safe, true zero-copy deserialization avoiding unnecessary allocations if the situation does not require having an owned version of the value.
Implementations§
source§impl<T, D> DataView<T, D>where
T: Archive,
T::Archived: CheckBytes<DefaultValidator<'static>> + 'static,
D: Deref<Target = [u8]> + Send + Sync,
impl<T, D> DataView<T, D>where
T: Archive,
T::Archived: CheckBytes<DefaultValidator<'static>> + 'static,
D: Deref<Target = [u8]> + Send + Sync,
source§impl<T, D> DataView<T, D>where
T: Archive,
T::Archived: Deserialize<T, SharedDeserializeMap> + 'static,
D: Deref<Target = [u8]> + Send + Sync,
impl<T, D> DataView<T, D>where
T: Archive,
T::Archived: Deserialize<T, SharedDeserializeMap> + 'static,
D: Deref<Target = [u8]> + Send + Sync,
sourcepub fn to_owned(&self) -> Result<T, InvalidView>
pub fn to_owned(&self) -> Result<T, InvalidView>
Deserializes the view into it’s owned value T.
Trait Implementations§
source§impl<T, D> Clone for DataView<T, D>where
T: Archive,
T::Archived: CheckBytes<DefaultValidator<'static>> + Debug,
D: Deref<Target = [u8]> + Send + Sync + Clone,
impl<T, D> Clone for DataView<T, D>where
T: Archive,
T::Archived: CheckBytes<DefaultValidator<'static>> + Debug,
D: Deref<Target = [u8]> + Send + Sync + Clone,
source§impl<T, D> Debug for DataView<T, D>where
T: Archive,
T::Archived: CheckBytes<DefaultValidator<'static>> + Debug,
D: Deref<Target = [u8]> + Send + Sync,
impl<T, D> Debug for DataView<T, D>where
T: Archive,
T::Archived: CheckBytes<DefaultValidator<'static>> + Debug,
D: Deref<Target = [u8]> + Send + Sync,
source§impl<T, D> Deref for DataView<T, D>where
T: Archive,
T::Archived: CheckBytes<DefaultValidator<'static>>,
D: Deref<Target = [u8]> + Send + Sync,
impl<T, D> Deref for DataView<T, D>where
T: Archive,
T::Archived: CheckBytes<DefaultValidator<'static>>,
D: Deref<Target = [u8]> + Send + Sync,
source§impl<T, D> PartialEq<DataView<T, D>> for DataView<T, D>where
T: Archive,
T::Archived: CheckBytes<DefaultValidator<'static>> + PartialEq,
D: Deref<Target = [u8]> + Send + Sync,
impl<T, D> PartialEq<DataView<T, D>> for DataView<T, D>where
T: Archive,
T::Archived: CheckBytes<DefaultValidator<'static>> + PartialEq,
D: Deref<Target = [u8]> + Send + Sync,
Auto Trait Implementations§
impl<T, D> RefUnwindSafe for DataView<T, D>where
D: RefUnwindSafe,
<T as Archive>::Archived: RefUnwindSafe,
impl<T, D> Send for DataView<T, D>where
<T as Archive>::Archived: Sync,
impl<T, D> Sync for DataView<T, D>where
<T as Archive>::Archived: Sync,
impl<T, D> Unpin for DataView<T, D>where
D: Unpin,
impl<T, D> UnwindSafe for DataView<T, D>where
D: UnwindSafe,
<T as Archive>::Archived: RefUnwindSafe,
Blanket Implementations§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
source§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
source§fn layout_raw(_: *const T) -> Layout
fn layout_raw(_: *const T) -> Layout
Gets the layout of the type.