Struct linux_syscall_api::File
source · 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<File, AxError>
pub fn create_new(path: &str) -> Result<File, AxError>
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.
sourcepub fn set_len(&self, size: u64) -> Result<(), AxError>
pub fn set_len(&self, size: u64) -> Result<(), AxError>
Truncates or extends the underlying file, updating the size of
this file to become size
.
sourcepub fn metadata(&self) -> Result<Metadata, AxError>
pub fn metadata(&self) -> Result<Metadata, AxError>
Queries metadata about the underlying file.
sourcepub fn executable(&self) -> bool
pub fn executable(&self) -> bool
Whether the file is executable.
sourcepub fn get_attr(&self) -> Result<VfsNodeAttr, AxError>
pub fn get_attr(&self) -> Result<VfsNodeAttr, AxError>
Get the file attributes.
Trait Implementations§
source§impl FileExt for File
impl FileExt for File
source§impl Read for File
impl Read for File
source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, AxError>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, AxError>
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>
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§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, AxError>
fn write(&mut self, buf: &[u8]) -> Result<usize, AxError>
Write a buffer into this writer, returning how many bytes were written.
source§fn flush(&mut self) -> Result<(), AxError>
fn flush(&mut self) -> Result<(), AxError>
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