pub trait AsyncMapWrite<'a, W> {
// Required method
fn map_with_capacity(
self,
process_fn: impl MapWriteFn + 'a,
capacity: usize,
) -> AsyncMapWriter<'a, W>;
// Provided method
fn map(self, process_fn: impl MapWriteFn + 'a) -> AsyncMapWriter<'a, W>
where Self: Sized { ... }
}
Expand description
A trait for types that can be mapped to an AsyncMapWriter
.
Required Methods§
Sourcefn map_with_capacity(
self,
process_fn: impl MapWriteFn + 'a,
capacity: usize,
) -> AsyncMapWriter<'a, W>
fn map_with_capacity( self, process_fn: impl MapWriteFn + 'a, capacity: usize, ) -> AsyncMapWriter<'a, W>
Maps the data written to the writer using the provided function with a specified buffer capacity.
This function allows you to specify the size of the internal buffer used for writing. The default buffer size is 8KB. If you need to optimize for larger writes, you can increase this size.
Provided Methods§
Sourcefn map(self, process_fn: impl MapWriteFn + 'a) -> AsyncMapWriter<'a, W>where
Self: Sized,
fn map(self, process_fn: impl MapWriteFn + 'a) -> AsyncMapWriter<'a, W>where
Self: Sized,
Maps the data written to the writer using the provided function.
This function will apply the mapping function to the data before writing it to the underlying writer. This also buffers the data (with a buffer size of 8KB) to optimize writes.
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.