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
sourceimpl<'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::Archived>
type Archived = ArchivedVec<T::Archived>
The archived type of a With<F, Self>
.
type Resolver = VecResolver
type Resolver = VecResolver
The resolver of a With<F, Self>
.
sourceimpl<'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>
.
sourceimpl<'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>
.
sourceimpl<'a, T: Archive + Clone, D: Fallible + ?Sized> DeserializeWith<<T as Archive>::Archived, T, D> for AsOwned where
T::Archived: Deserialize<T, D>,
impl<'a, T: Archive + Clone, D: Fallible + ?Sized> DeserializeWith<<T as Archive>::Archived, T, D> for AsOwned where
T::Archived: Deserialize<T, D>,
sourceimpl<'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
sourcefn 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.
sourceimpl<'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
sourcefn 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.
sourceimpl<'a, T, D> DeserializeWith<ArchivedVec<<T as Archive>::Archived>, Cow<'a, [T]>, D> for AsOwned where
T: Archive + Clone,
T::Archived: Deserialize<T, D>,
D: Fallible + ?Sized,
impl<'a, T, D> DeserializeWith<ArchivedVec<<T as Archive>::Archived>, Cow<'a, [T]>, D> for AsOwned where
T: Archive + Clone,
T::Archived: Deserialize<T, D>,
D: Fallible + ?Sized,
sourcefn 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.
sourceimpl<'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
sourceimpl<'a, S: Serializer + ?Sized> SerializeWith<Cow<'a, CStr>, S> for AsOwned
impl<'a, S: Serializer + ?Sized> SerializeWith<Cow<'a, CStr>, S> for AsOwned
sourceimpl<'a, F: Serialize<S> + Clone, S: Fallible + ?Sized> SerializeWith<Cow<'a, F>, S> for AsOwned
impl<'a, F: Serialize<S> + Clone, S: Fallible + ?Sized> SerializeWith<Cow<'a, F>, S> for AsOwned
sourceimpl<'a, S: Serializer + ?Sized> SerializeWith<Cow<'a, str>, S> for AsOwned
impl<'a, S: Serializer + ?Sized> SerializeWith<Cow<'a, str>, 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
sourceimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
sourcefn pointer_metadata(_: &Self::ArchivedMetadata) -> <Self as Pointee>::Metadata
fn pointer_metadata(_: &Self::ArchivedMetadata) -> <Self as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more