pub struct FileSystem {}Expand description
the root filesystem API
Implementations§
Source§impl FileSystem
impl FileSystem
Sourcepub fn open(s: &str) -> Result<File, IoError>
pub fn open(s: &str) -> Result<File, IoError>
open a file.
For a file to be accessible from both native and web build, it should be placed
in a www/ directory in your project’s root directory, for example www/config.json.
You can then open this file with FileSystem::open("config.json").
When running your native project, use cd www && cargo run.
When deploying on the web, the file should simply be in the same directory as index.html, as config.json.
Note that on wasm target, this works with any URL, you can do :
FileSystem::open('https://raw.githubusercontent.com/unrust/uni-app/master/www/test.txt')
To be able to load data from an URL in native mode, you have to enable the http feature.
Auto Trait Implementations§
impl Freeze for FileSystem
impl RefUnwindSafe for FileSystem
impl Send for FileSystem
impl Sync for FileSystem
impl Unpin for FileSystem
impl UnwindSafe for FileSystem
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