pub struct File<Access: AccessMode = ReadWrite> { /* private fields */ }
Available on
Linux
only.Expand description
An open file, allowing for reading and writing according to the associated AccessMode
. The
underlying file is guaranteed to exist for the lifetime of the File
.
Implementations§
Source§impl<A: AccessMode> File<A>
impl<A: AccessMode> File<A>
pub fn options() -> OpenOptions<A>
pub fn metadata(&self) -> Result<Metadata, MetadataError>
pub fn close(self) -> Result<(), CloseError>
pub fn sync(&self) -> Result<(), SyncError>
pub fn try_clone(&self) -> Result<File, CloneError>
pub fn lock(&self) -> Result<(), LockError>
pub fn try_lock(&self) -> Result<(), TryLockError>
pub fn unlock(&self) -> Result<(), LockError>
Source§impl File<ReadWrite>
impl File<ReadWrite>
pub fn open<P: AsRef<Path<Abs>>>( file_path: P, ) -> Result<File<ReadWrite>, RawOsError>
pub fn create<P: AsRef<Path<Abs>>>( file_path: P, file_mode: u16, ) -> Result<File<ReadWrite>, RawOsError>
pub fn open_or_create<P: AsRef<Path<Abs>>>( file_path: P, file_mode: u16, ) -> Result<File<ReadWrite>, RawOsError>
pub fn open_rel<P: AsRef<Path<Rel>>>( relative_to: &Directory, file_path: P, ) -> Result<File<ReadWrite>, RawOsError>
pub fn create_rel<P: AsRef<Path<Rel>>>( relative_to: &Directory, file_path: P, file_mode: u16, ) -> Result<File<ReadWrite>, RawOsError>
pub fn open_or_create_rel<P: AsRef<Path<Rel>>>( relative_to: &Directory, file_path: P, file_mode: u16, ) -> Result<File<ReadWrite>, RawOsError>
pub fn create_temp() -> Result<File<ReadWrite>, RawOsError>
Source§impl<A: Read> File<A>
impl<A: Read> File<A>
pub fn read(&self, buf: &mut [u8]) -> Result<usize, RawOsError>
pub fn read_all_vec(&self) -> Result<Vector<u8>, RawOsError>
pub fn read_all_string(&self) -> Result<String, RawOsError>
Trait Implementations§
Auto Trait Implementations§
impl<Access> Freeze for File<Access>
impl<Access> RefUnwindSafe for File<Access>
impl<Access> Send for File<Access>
impl<Access> Sync for File<Access>
impl<Access> Unpin for File<Access>
impl<Access> UnwindSafe for File<Access>
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