pub trait Input {
type Item;
// Required method
unsafe fn read_unchecked(
&mut self,
output: &mut [Self::Item],
index: usize,
count: usize,
) -> Result<usize>;
}Expand description
Minimal indexed input interface over units.
Input is intentionally smaller and lower-level than Read. It only
states that an implementor can read up to count units into
output[index..index + count]. The caller owns range validation so hot
paths can avoid repeated slicing and bounds checks.
Required Associated Types§
Required Methods§
Sourceunsafe fn read_unchecked(
&mut self,
output: &mut [Self::Item],
index: usize,
count: usize,
) -> Result<usize>
unsafe fn read_unchecked( &mut self, output: &mut [Self::Item], index: usize, count: usize, ) -> Result<usize>
Reads units into an indexed output range without checking the range.
§Parameters
output- Destination storage.index- Start index insideoutput.count- Maximum number of units to read.
§Returns
The number of units written into output[index..index + count]. The
value must be in 0..=count.
§Errors
Returns the input error reported by the implementation.
§Safety
The caller must guarantee that index..index + count is a valid range
inside output 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".