pub struct FileWrite { /* private fields */ }Expand description
A safe wrapper over a C filestream with write permissions
Implementations§
Source§impl FileWrite
impl FileWrite
Sourcepub fn create(path: &str) -> Result<FileWrite, PROSErr>
pub fn create(path: &str) -> Result<FileWrite, PROSErr>
Creates a new file
§Errors
- Returns
PROSErr::IOon low-level hardware I/O error - Returns
PROSErr::Invalidwhen the length or path is invalid - Returns
PROSErr::NoEntrywhen the path cannot be found - Returns
PROSErr::Accesswhen access is denied - Returns
PROSErr::Existswhen access is denied - Returns
PROSErr::ReadOnlyFSwhen the SD card is write protected - Returns
PROSErr::NXIOwhen the drive number is invalid or not an FAT32 drive - Returns
PROSErr::NoBuffSpacewhen the drive has no work area - Returns
PROSErr::NoMoreFileswhen there are too many open files
§Warning
All paths must start with /usd/, if you don’t it won’t work
Sourcepub fn open(path: &str) -> Result<FileWrite, PROSErr>
pub fn open(path: &str) -> Result<FileWrite, PROSErr>
Opens a file that already exists
§Errors
- Returns
PROSErr::IOon low-level hardware I/O error - Returns
PROSErr::Invalidwhen the length or path is invalid - Returns
PROSErr::NoEntrywhen the path cannot be found - Returns
PROSErr::Accesswhen access is denied - Returns
PROSErr::Existswhen access is denied - Returns
PROSErr::ReadOnlyFSwhen the SD card is write protected - Returns
PROSErr::NXIOwhen the drive number is invalid or not an FAT32 drive - Returns
PROSErr::NoBuffSpacewhen the drive has no work area - Returns
PROSErr::NoMoreFileswhen there are too many open files
§Warning
All paths must start with /usd/, if you don’t it won’t work
Sourcepub fn write(&mut self, string: &str) -> Result<(), PROSErr>
pub fn write(&mut self, string: &str) -> Result<(), PROSErr>
Writes a string to the file
§WARNING
§Errors
- Returns
PROSErr::IOon low-level hardware I/O error - Returns
PROSErr::Accesswhen access is denied - Returns
PROSErr::Existswhen access is denied - Returns
PROSErr::ReadOnlyFSwhen the SD card is write protected - Returns
PROSErr::NXIOwhen the drive number is invalid or not an FAT32 drive - Returns
PROSErr::NoBuffSpacewhen the drive has no work area - Returns
PROSErr::NoMoreFileswhen there are too many open files
Trait Implementations§
Auto Trait Implementations§
impl !Send for FileWrite
impl !Sync for FileWrite
impl Freeze for FileWrite
impl RefUnwindSafe for FileWrite
impl Unpin for FileWrite
impl UnsafeUnpin for FileWrite
impl UnwindSafe for FileWrite
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