pub trait WriteCollection<Ctx> {
// Required methods
fn write_slice_with<T, E, F>(&mut self, slice: &[T], f: F) -> Result<(), E>
where E: From<Error>,
F: FnMut(&mut Writer<Ctx>, &T) -> Result<(), E>;
fn write_prefixed_slice_with<T, L, E, F>(
&mut self,
slice: &[T],
f: F,
) -> Result<(), E>
where L: Encode<Ctx, Error = Error> + CollectionLength,
E: From<Error>,
F: FnMut(&mut Writer<Ctx>, &T) -> Result<(), E>;
// Provided methods
fn write_slice<T>(&mut self, slice: &[T]) -> Result<(), T::Error>
where T: Encode<Ctx> { ... }
fn write_prefixed_slice<T, L>(
&mut self,
slice: &[T],
) -> Result<(), T::Error>
where T: Encode<Ctx>,
L: Encode<Ctx, Error = Error> + CollectionLength { ... }
}Expand description
A trait for writing collections of data to a writer.
Required Methods§
Sourcefn write_slice_with<T, E, F>(&mut self, slice: &[T], f: F) -> Result<(), E>
fn write_slice_with<T, E, F>(&mut self, slice: &[T], f: F) -> Result<(), E>
Writes a slice of elements to the writer using the provided function.
Sourcefn write_prefixed_slice_with<T, L, E, F>(
&mut self,
slice: &[T],
f: F,
) -> Result<(), E>
fn write_prefixed_slice_with<T, L, E, F>( &mut self, slice: &[T], f: F, ) -> Result<(), E>
Writes a slice of elements to the writer with a length prefix, using the provided function to write each element.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".