Trait WriterExt
pub trait WriterExt<E>: Writer<E> {
// Provided methods
fn pad(&mut self, padding: usize) -> Result<(), E> ⓘ { ... }
fn align(&mut self, align: usize) -> Result<usize, E> ⓘ { ... }
fn align_for<T>(&mut self) -> Result<usize, E> ⓘ { ... }
unsafe fn resolve_aligned<T>(
&mut self,
value: &T,
resolver: <T as Archive>::Resolver,
) -> Result<usize, E> ⓘ
where T: Archive + ?Sized { ... }
unsafe fn resolve_unsized_aligned<T>(
&mut self,
value: &T,
to: usize,
) -> Result<usize, E> ⓘ
where T: ArchiveUnsized + ?Sized { ... }
}
Available on crate feature
dep_rkyv
only.Expand description
Helper methods for Writer
.
Provided Methods§
fn align(&mut self, align: usize) -> Result<usize, E> ⓘ
fn align(&mut self, align: usize) -> Result<usize, E> ⓘ
Aligns the position of the serializer to the given alignment.
fn align_for<T>(&mut self) -> Result<usize, E> ⓘ
fn align_for<T>(&mut self) -> Result<usize, E> ⓘ
Aligns the position of the serializer to be suitable to write the given type.
unsafe fn resolve_aligned<T>(
&mut self,
value: &T,
resolver: <T as Archive>::Resolver,
) -> Result<usize, E> ⓘ
unsafe fn resolve_aligned<T>( &mut self, value: &T, resolver: <T as Archive>::Resolver, ) -> Result<usize, E> ⓘ
Resolves the given value with its resolver and writes the archived type.
Returns the position of the written archived type.
§Safety
resolver
must be the result of serializingvalue
- The serializer must be aligned for a
T::Archived
unsafe fn resolve_unsized_aligned<T>(
&mut self,
value: &T,
to: usize,
) -> Result<usize, E> ⓘwhere
T: ArchiveUnsized + ?Sized,
unsafe fn resolve_unsized_aligned<T>(
&mut self,
value: &T,
to: usize,
) -> Result<usize, E> ⓘwhere
T: ArchiveUnsized + ?Sized,
Resolves the given reference with its resolver and writes the archived reference.
Returns the position of the written archived RelPtr
.
§Safety
The serializer must be aligned for a RelPtr<T::Archived>
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.