pub struct StreamSlice<T: Read + Write + Seek> { /* private fields */ }Expand description
Stream wrapper for accessing limited segment of data from underlying file or device.
Implementations§
Source§impl<T: Read + Write + Seek> StreamSlice<T>
impl<T: Read + Write + Seek> StreamSlice<T>
Sourcepub async fn new(
inner: T,
start_offset: u64,
end_offset: u64,
) -> Result<Self, StreamSliceError<T::Error>>
pub async fn new( inner: T, start_offset: u64, end_offset: u64, ) -> Result<Self, StreamSliceError<T::Error>>
Creates new StreamSlice from inner stream and offset range.
start_offset is inclusive offset of the first accessible byte.
end_offset is exclusive offset of the first non-accessible byte.
start_offset must be lower or equal to end_offset.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Returns inner object
Trait Implementations§
Source§impl<T: Read + Write + Seek> Read for StreamSlice<T>
impl<T: Read + Write + Seek> Read for StreamSlice<T>
Source§async fn read(
&mut self,
buf: &mut [u8],
) -> Result<usize, StreamSliceError<T::Error>>
async fn read( &mut self, buf: &mut [u8], ) -> Result<usize, StreamSliceError<T::Error>>
Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
Read the exact number of bytes required to fill
buf. Read moreSource§impl<T: Read + Write + Seek> Seek for StreamSlice<T>
impl<T: Read + Write + Seek> Seek for StreamSlice<T>
Source§impl<T: Read + Write + Seek> Write for StreamSlice<T>
impl<T: Read + Write + Seek> Write for StreamSlice<T>
Source§async fn write(
&mut self,
buf: &[u8],
) -> Result<usize, StreamSliceError<T::Error>>
async fn write( &mut self, buf: &[u8], ) -> Result<usize, StreamSliceError<T::Error>>
Write a buffer into this writer, returning how many bytes were written. Read more