pub struct File<'a, S: Storage> { /* private fields */ }Expand description
An open file handle.
Obtained from Filesystem::open. Automatically closed on drop; call
File::close explicitly to check for errors.
Implementations§
Source§impl<'a, S: Storage> File<'a, S>
impl<'a, S: Storage> File<'a, S>
Sourcepub fn read(&self, buf: &mut [u8]) -> Result<u32, Error>
pub fn read(&self, buf: &mut [u8]) -> Result<u32, Error>
Read up to buf.len() bytes from the current position.
Returns the number of bytes actually read.
Sourcepub fn write(&self, data: &[u8]) -> Result<u32, Error>
pub fn write(&self, data: &[u8]) -> Result<u32, Error>
Write data at the current position. Returns the number of bytes written.
Sourcepub fn seek(&self, pos: SeekFrom) -> Result<u32, Error>
pub fn seek(&self, pos: SeekFrom) -> Result<u32, Error>
Seek to a position. Returns the new absolute offset.
Trait Implementations§
Auto Trait Implementations§
impl<'a, S> Freeze for File<'a, S>
impl<'a, S> !RefUnwindSafe for File<'a, S>
impl<'a, S> !Send for File<'a, S>
impl<'a, S> !Sync for File<'a, S>
impl<'a, S> Unpin for File<'a, S>
impl<'a, S> UnsafeUnpin for File<'a, S>
impl<'a, S> !UnwindSafe for File<'a, S>
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