pub trait CountedSink {
type Error;
// Required method
fn write(&mut self, bytes: &[u8]) -> Result<usize, Self::Error>;
}Expand description
A sink whose successful writes report their exact accepted prefix.
write must return an accepted count no larger than bytes.len(). Err
must mean that the failing call accepted zero bytes. This stronger contract
lets Base64::encode_to_counted report exact committed progress; sinks
that can mutate before returning Err must use formatter or I/O contracts
with weaker prefix guarantees instead.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".