pub struct File<'a> { /* private fields */ }Expand description
Struct to represent a file or directory. This struct is used to abstract away the underlying file system.
Implementations§
Source§impl File<'_>
impl File<'_>
Sourcepub fn read_dir(&self) -> Result<Vec<String>, FileErr>
pub fn read_dir(&self) -> Result<Vec<String>, FileErr>
If File is a directory, return a vector of the files in the directory.
If File is a file, return an error FileErr::NotADirectory.
Sourcepub fn create_file(&self) -> Result<(), FileErr>
pub fn create_file(&self) -> Result<(), FileErr>
Create a file. If the file already exist, an error FileErr::FileAlreadyExist will be returned.
pub fn path(&self) -> String
Auto Trait Implementations§
impl<'a> Freeze for File<'a>
impl<'a> RefUnwindSafe for File<'a>
impl<'a> Send for File<'a>
impl<'a> Sync for File<'a>
impl<'a> Unpin for File<'a>
impl<'a> UnwindSafe for File<'a>
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