Struct rkyv::ser::serializers::WriteSerializer [−][src]
pub struct WriteSerializer<W: Write> { /* fields omitted */ }
Expand description
Wraps a type that implements io::Write
and equips it with Serializer
.
Examples
use rkyv::ser::{serializers::WriteSerializer, Serializer}; let mut serializer = WriteSerializer::new(Vec::new()); assert_eq!(serializer.pos(), 0); serializer.write(&[0u8, 1u8, 2u8, 3u8]); assert_eq!(serializer.pos(), 4); let buf = serializer.into_inner(); assert_eq!(buf.len(), 4); assert_eq!(buf, vec![0u8, 1u8, 2u8, 3u8]);
Implementations
Creates a new serializer from a writer, and assumes that the underlying writer is currently at the given position.
Consumes the serializer and returns the internal writer used to create it.
Trait Implementations
Attempts to write the given bytes to the serializer.
Advances the given number of bytes as padding.
Aligns the position of the serializer to the given alignment.
Aligns the position of the serializer to be suitable to write the given type.
Resolves the given value with its resolver and writes the archived type. Read more
Archives the given object and returns the position it was archived at.
unsafe fn resolve_unsized_aligned<T: ArchiveUnsized + ?Sized>(
&mut self,
value: &T,
to: usize,
metadata_resolver: T::MetadataResolver
) -> Result<usize, Self::Error>
unsafe fn resolve_unsized_aligned<T: ArchiveUnsized + ?Sized>(
&mut self,
value: &T,
to: usize,
metadata_resolver: T::MetadataResolver
) -> Result<usize, Self::Error>
Resolves the given reference with its resolver and writes the archived reference. Read more
fn serialize_unsized_value<T: SerializeUnsized<Self> + ?Sized>(
&mut self,
value: &T
) -> Result<usize, Self::Error>
fn serialize_unsized_value<T: SerializeUnsized<Self> + ?Sized>(
&mut self,
value: &T
) -> Result<usize, Self::Error>
Archives a reference to the given object and returns the position it was archived at.
Auto Trait Implementations
impl<W> RefUnwindSafe for WriteSerializer<W> where
W: RefUnwindSafe,
impl<W> Send for WriteSerializer<W> where
W: Send,
impl<W> Sync for WriteSerializer<W> where
W: Sync,
impl<W> Unpin for WriteSerializer<W> where
W: Unpin,
impl<W> UnwindSafe for WriteSerializer<W> where
W: UnwindSafe,
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
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
D: Fallible + ?Sized,
F: ?Sized,
W: DeserializeWith<F, T, D>,
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
D: Fallible + ?Sized,
F: ?Sized,
W: DeserializeWith<F, T, D>,