pub struct AsOwned;Expand description
A wrapper that serializes a Cow as if it were owned.
§Example
use std::borrow::Cow;
use rkyv::{with::AsOwned, Archive};
#[derive(Archive)]
struct Example<'a> {
#[rkyv(with = AsOwned)]
a: Cow<'a, str>,
}Trait Implementations§
Source§impl<'a, T: Archive + Clone> ArchiveWith<Cow<'a, [T]>> for AsOwned
impl<'a, T: Archive + Clone> ArchiveWith<Cow<'a, [T]>> for AsOwned
Source§type Resolver = VecResolver
type Resolver = VecResolver
The resolver of a
Self with F.Source§impl<'a> ArchiveWith<Cow<'a, CStr>> for AsOwned
impl<'a> ArchiveWith<Cow<'a, CStr>> for AsOwned
Source§type Archived = ArchivedCString
type Archived = ArchivedCString
The archived type of
Self with F.Source§type Resolver = CStringResolver
type Resolver = CStringResolver
The resolver of a
Self with F.Source§impl<'a> ArchiveWith<Cow<'a, str>> for AsOwned
impl<'a> ArchiveWith<Cow<'a, str>> for AsOwned
Source§type Archived = ArchivedString
type Archived = ArchivedString
The archived type of
Self with F.Source§type Resolver = StringResolver
type Resolver = StringResolver
The resolver of a
Self with F.Source§impl<'a, D> DeserializeWith<ArchivedCString, Cow<'a, CStr>, D> for AsOwned
impl<'a, D> DeserializeWith<ArchivedCString, Cow<'a, CStr>, D> for AsOwned
Source§fn deserialize_with(
field: &ArchivedCString,
deserializer: &mut D,
) -> Result<Cow<'a, CStr>, D::Error>
fn deserialize_with( field: &ArchivedCString, deserializer: &mut D, ) -> Result<Cow<'a, CStr>, D::Error>
Deserializes the field type
F using the given deserializer.Source§impl<'a, D> DeserializeWith<ArchivedString, Cow<'a, str>, D> for AsOwned
impl<'a, D> DeserializeWith<ArchivedString, Cow<'a, str>, D> for AsOwned
Source§fn deserialize_with(
field: &ArchivedString,
deserializer: &mut D,
) -> Result<Cow<'a, str>, D::Error>
fn deserialize_with( field: &ArchivedString, deserializer: &mut D, ) -> Result<Cow<'a, str>, D::Error>
Deserializes the field type
F using the given deserializer.Source§impl<'a, T, D> DeserializeWith<ArchivedVec<<T as Archive>::Archived>, Cow<'a, [T]>, D> for AsOwned
impl<'a, T, D> DeserializeWith<ArchivedVec<<T as Archive>::Archived>, Cow<'a, [T]>, D> for AsOwned
Source§fn deserialize_with(
field: &ArchivedVec<T::Archived>,
deserializer: &mut D,
) -> Result<Cow<'a, [T]>, D::Error>
fn deserialize_with( field: &ArchivedVec<T::Archived>, deserializer: &mut D, ) -> Result<Cow<'a, [T]>, D::Error>
Deserializes the field type
F using the given deserializer.Source§impl<'a, F, S> SerializeWith<Cow<'a, F>, S> for AsOwned
impl<'a, F, S> SerializeWith<Cow<'a, F>, S> for AsOwned
Auto Trait Implementations§
impl Freeze for AsOwned
impl RefUnwindSafe for AsOwned
impl Send for AsOwned
impl Sync for AsOwned
impl Unpin for AsOwned
impl UnsafeUnpin for AsOwned
impl UnwindSafe for AsOwned
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§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<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
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.