pub struct File { /* private fields */ }
Available on crate feature
fs
only.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_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, AxError>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, AxError>
Available on crate feature
alloc
only.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>
Available on crate feature
alloc
only.Read all bytes until EOF in this source, appending them to
buf
.source§impl Seek for File
impl Seek for File
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.
Auto Trait Implementations§
impl !RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin 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