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::IO
on low-level hardware I/O error - Returns
PROSErr::Invalid
when the length or path is invalid - Returns
PROSErr::NoEntry
when the path cannot be found - Returns
PROSErr::Access
when access is denied - Returns
PROSErr::Exists
when access is denied - Returns
PROSErr::ReadOnlyFS
when the SD card is write protected - Returns
PROSErr::NXIO
when the drive number is invalid or not an FAT32 drive - Returns
PROSErr::NoBuffSpace
when the drive has no work area - Returns
PROSErr::NoMoreFiles
when 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::IO
on low-level hardware I/O error - Returns
PROSErr::Invalid
when the length or path is invalid - Returns
PROSErr::NoEntry
when the path cannot be found - Returns
PROSErr::Access
when access is denied - Returns
PROSErr::Exists
when access is denied - Returns
PROSErr::ReadOnlyFS
when the SD card is write protected - Returns
PROSErr::NXIO
when the drive number is invalid or not an FAT32 drive - Returns
PROSErr::NoBuffSpace
when the drive has no work area - Returns
PROSErr::NoMoreFiles
when 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::IO
on low-level hardware I/O error - Returns
PROSErr::Access
when access is denied - Returns
PROSErr::Exists
when access is denied - Returns
PROSErr::ReadOnlyFS
when the SD card is write protected - Returns
PROSErr::NXIO
when the drive number is invalid or not an FAT32 drive - Returns
PROSErr::NoBuffSpace
when the drive has no work area - Returns
PROSErr::NoMoreFiles
when there are too many open files
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileWrite
impl RefUnwindSafe for FileWrite
impl !Send for FileWrite
impl !Sync for FileWrite
impl Unpin 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