Struct hdfs_native::file::FileReader
source · pub struct FileReader { /* private fields */ }
Implementations§
source§impl FileReader
impl FileReader
pub fn file_length(&self) -> usize
pub fn remaining(&self) -> usize
sourcepub async fn read_buf(&mut self, buf: &mut [u8]) -> Result<usize>
pub async fn read_buf(&mut self, buf: &mut [u8]) -> Result<usize>
Read up to buf.len()
bytes into the provided slice, advancing the internal position in the file.
Returns the number of bytes that were read, or 0 if the end of the file has been reached.
sourcepub async fn read_range(&self, offset: usize, len: usize) -> Result<Bytes>
pub async fn read_range(&self, offset: usize, len: usize) -> Result<Bytes>
Read up to len
bytes starting at offset
into a new Bytes object. The returned buffer
could be smaller than len
if offset + len
extends beyond the end of the file.
Panics if the requested range is outside of the file
Auto Trait Implementations§
impl RefUnwindSafe for FileReader
impl Send for FileReader
impl Sync for FileReader
impl Unpin for FileReader
impl UnwindSafe for FileReader
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