pub struct FileReadAt { /* private fields */ }Expand description
ReadAt over a file, using positional reads on Unix and Windows and
seek + read elsewhere. Unix reads leave a shared file cursor unchanged;
Windows seek_read can update it. No implementation uses unsafe.
The caller must keep the opened file’s bytes stable for the decoder operation.
This adapter captures its length but neither locks the file nor detects every
in-place replacement. An open handle and positional reads do not establish
the coherent-representation contract of ReadAt.
Implementations§
Source§impl FileReadAt
impl FileReadAt
Trait Implementations§
Source§impl ReadAt for FileReadAt
impl ReadAt for FileReadAt
Source§type Error = StdSourceError
type Error = StdSourceError
The source-specific error type.
Source§fn len(&mut self) -> Result<u64, Self::Error>
fn len(&mut self) -> Result<u64, Self::Error>
Total length in bytes. May be expensive: a buffered stream source
consumes to the end of the stream to answer it. Callers that only
read forward use
read_at, which reports the end
by returning fewer bytes, and never need this.Source§fn len_hint(&self) -> Option<u64>
fn len_hint(&self) -> Option<u64>
Total length if it is known without reading ahead. Default
None.Source§fn read_exact_at(
&mut self,
offset: u64,
out: &mut [u8],
) -> Result<(), Self::Error>
fn read_exact_at( &mut self, offset: u64, out: &mut [u8], ) -> Result<(), Self::Error>
Fill
out with the bytes at offset. Fails rather than returning
a short read.Source§fn read_at(&mut self, offset: u64, out: &mut [u8]) -> Result<usize, Self::Error>
fn read_at(&mut self, offset: u64, out: &mut [u8]) -> Result<usize, Self::Error>
Read up to
out.len() bytes at offset; returns the count, which is
smaller only where the source ends (zero at or past the end). Read moreAuto Trait Implementations§
impl Freeze for FileReadAt
impl RefUnwindSafe for FileReadAt
impl Send for FileReadAt
impl Sync for FileReadAt
impl Unpin for FileReadAt
impl UnsafeUnpin for FileReadAt
impl UnwindSafe for FileReadAt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more