pub struct File { /* private fields */ }Expand description
An object providing access to an open file on the filesystem.
Implementations§
Source§impl File
impl File
Sourcepub fn create_new(path: &str) -> Result<Self>
pub fn create_new(path: &str) -> Result<Self>
Creates a new file in read-write mode; error if the file exists.
Sourcepub fn options() -> OpenOptions
pub fn options() -> OpenOptions
Returns a new OpenOptions object.
Trait Implementations§
Source§impl Read for File
impl Read for File
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning
how many bytes were read.
Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), AxError>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), AxError>
Read the exact number of bytes required to fill
buf.Source§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), AxError>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), AxError>
Pull some bytes from this source into the specified buffer. Read more
Source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), AxError>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), AxError>
Reads the exact number of bytes required to fill
cursor. Read moreSource§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, AxError>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, AxError>
Read all bytes until EOF in this source, placing them into
buf.Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, AxError>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, AxError>
Read all bytes until EOF in this source, appending them to
buf.Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Creates a “by reference” adapter for this instance of
Read. Read moreSource§impl Seek for File
impl Seek for File
Source§fn seek(&mut self, pos: SeekFrom) -> Result<u64>
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
Seek to an offset, in bytes, in a stream. Read more
Source§fn stream_position(&mut self) -> Result<u64, AxError>
fn stream_position(&mut self) -> Result<u64, AxError>
Returns the current seek position from the start of the stream. Read more
Source§impl Write for File
impl Write for File
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written.
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered
contents reach their destination.
Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), AxError>
fn write_all(&mut self, buf: &[u8]) -> Result<(), AxError>
Attempts to write an entire buffer into this writer.
Auto Trait Implementations§
impl Freeze for File
impl !RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl UnsafeUnpin for File
impl !UnwindSafe for File
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