pub struct AsOwned;
Expand description
A wrapper that serializes a Cow
as if it were owned.
§Example
use std::borrow::Cow;
use rkyv::{Archive, with::AsOwned};
#[derive(Archive)]
struct Example<'a> {
#[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
§type Archived = ArchivedVec<<T as Archive>::Archived>
type Archived = ArchivedVec<<T as Archive>::Archived>
The archived type of a
With<F, Self>
.§type Resolver = VecResolver
type Resolver = VecResolver
The resolver of a
With<F, Self>
.source§impl<'a> ArchiveWith<Cow<'a, CStr>> for AsOwned
impl<'a> ArchiveWith<Cow<'a, CStr>> for AsOwned
§type Archived = ArchivedCString
type Archived = ArchivedCString
The archived type of a
With<F, Self>
.§type Resolver = CStringResolver
type Resolver = CStringResolver
The resolver of a
With<F, Self>
.source§impl<'a> ArchiveWith<Cow<'a, str>> for AsOwned
impl<'a> ArchiveWith<Cow<'a, str>> for AsOwned
§type Archived = ArchivedString
type Archived = ArchivedString
The archived type of a
With<F, Self>
.§type Resolver = StringResolver
type Resolver = StringResolver
The resolver of a
With<F, Self>
.source§impl<T: Archive + Clone, D: Fallible + ?Sized> DeserializeWith<<T as Archive>::Archived, T, D> for AsOwnedwhere
T::Archived: Deserialize<T, D>,
impl<T: Archive + Clone, D: Fallible + ?Sized> DeserializeWith<<T as Archive>::Archived, T, D> for AsOwnedwhere
T::Archived: Deserialize<T, D>,
source§impl<'a, D: Fallible + ?Sized> DeserializeWith<ArchivedCString, Cow<'a, CStr>, D> for AsOwned
impl<'a, D: Fallible + ?Sized> 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: Fallible + ?Sized> DeserializeWith<ArchivedString, Cow<'a, str>, D> for AsOwned
impl<'a, D: Fallible + ?Sized> 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, T: Serialize<S> + Clone, S: ScratchSpace + Serializer + ?Sized> SerializeWith<Cow<'a, [T]>, S> for AsOwned
impl<'a, T: Serialize<S> + Clone, S: ScratchSpace + Serializer + ?Sized> SerializeWith<Cow<'a, [T]>, S> for AsOwned
source§impl<'a, S: Serializer + ?Sized> SerializeWith<Cow<'a, CStr>, S> for AsOwned
impl<'a, S: Serializer + ?Sized> SerializeWith<Cow<'a, CStr>, S> for AsOwned
Auto Trait Implementations§
impl RefUnwindSafe for AsOwned
impl Send for AsOwned
impl Sync for AsOwned
impl Unpin for AsOwned
impl UnwindSafe for AsOwned
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<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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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>
Gets the layout of the type.