Struct rkyv::with::AsString [−][src]
pub struct AsString;Expand description
A wrapper that attempts to convert a type to and from UTF-8.
Types like OsString and PathBuf aren’t guaranteed to be encoded as UTF-8, but they usually
are anyway. Using this wrapper will archive them as if they were regular Strings.
Regular serializers don’t support the custom error handling needed for this type by default. To
use this wrapper, a custom serializer with an error type satisfying
<S as Fallible>::Error: From<AsStringError> must be provided.
Example
use std::{ffi::OsString, path::PathBuf};
use rkyv::{Archive, with::AsString};
#[derive(Archive)]
struct Example {
#[with(AsString)]
os_string: OsString,
#[with(AsString)]
path: PathBuf,
}Trait Implementations
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>.
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>.
Deserializes the field type F using the given deserializer.
Deserializes the field type F using the given deserializer.
impl<S: Fallible + ?Sized> SerializeWith<OsString, S> for AsString where
S::Error: From<AsStringError>,
str: SerializeUnsized<S>,
impl<S: Fallible + ?Sized> SerializeWith<OsString, S> for AsString where
S::Error: From<AsStringError>,
str: SerializeUnsized<S>,
impl<S: Fallible + ?Sized> SerializeWith<PathBuf, S> for AsString where
S::Error: From<AsStringError>,
str: SerializeUnsized<S>,
impl<S: Fallible + ?Sized> SerializeWith<PathBuf, S> for AsString where
S::Error: From<AsStringError>,
str: SerializeUnsized<S>,
Auto Trait Implementations
impl RefUnwindSafe for AsString
impl UnwindSafe for AsString
Blanket Implementations
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Converts some archived metadata to the pointer metadata for itself.
Mutably borrows from an owned value. Read more