pub trait Output {
type Item;
// Required methods
unsafe fn write_unchecked(
&mut self,
input: &[Self::Item],
index: usize,
count: usize,
) -> Result<usize>;
fn flush(&mut self) -> Result<()>;
}Expand description
Minimal indexed output interface over units.
Output is intentionally smaller and lower-level than Write. It only
states that an implementor can write up to count units from
input[index..index + count], plus an explicit flush operation. The caller
owns range validation so hot paths can avoid repeated slicing and bounds
checks.
Required Associated Types§
Required Methods§
Sourceunsafe fn write_unchecked(
&mut self,
input: &[Self::Item],
index: usize,
count: usize,
) -> Result<usize>
unsafe fn write_unchecked( &mut self, input: &[Self::Item], index: usize, count: usize, ) -> Result<usize>
Writes units from an indexed input range without checking the range.
§Parameters
input- Source storage.index- Start index insideinput.count- Maximum number of units to write.
§Returns
The number of units accepted from input[index..index + count]. The
value must be in 0..=count.
§Errors
Returns the output error reported by the implementation.
§Safety
The caller must guarantee that index..index + count is a valid range
inside input and that the addition does not overflow.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".