pub enum File {
Native(File),
}Expand description
synchronous (native) / asynchronous (web) file API
Variants§
Implementations§
Source§impl File
impl File
Sourcepub fn read_binary(&mut self) -> Result<Vec<u8>, IoError>
pub fn read_binary(&mut self) -> Result<Vec<u8>, IoError>
Once the file has been loaded (see File::is_ready), returns the file content as Vec<u8>
Sourcepub fn read_text(&mut self) -> Result<String, IoError>
pub fn read_text(&mut self) -> Result<String, IoError>
Once the file has been loaded (see File::is_ready), returns the file content as a String
Sourcepub fn is_ready(&mut self) -> bool
pub fn is_ready(&mut self) -> bool
return true if the file has been loaded
On native target, files are loaded synchronously.
As soon as FileSystem::open returns, the file is ready.
File::read_binary and File::read_text can be called immediately.
On web target, files are loaded asynchronously.
You have to poll File::is_ready until it returns true.
Only then you can call File::read_binary or File::read_text.
Auto Trait Implementations§
impl Freeze for File
impl RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl UnsafeUnpin 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