pub async fn load_file(path: &str) -> Result<Vec<u8>, FileError> {
    fn load_file_inner(path: &str) -> exec::FileLoadingFuture {
        use std::cell::RefCell;
        use std::rc::Rc;

        let contents = Rc::new(RefCell::new(None));
        let path = path.to_owned();

        {
            let contents = contents.clone();
            let err_path = path.clone();

            fs::load_file(&path, move |bytes| {
                *contents.borrow_mut() =
                    Some(bytes.map_err(|kind| FileError::new(kind, &err_path)));
            });
        }

        exec::FileLoadingFuture { contents }
    }

    load_file_inner(&get_path(path)).await
}
/// Load file from the path and block until its loaded
/// Will use filesystem on PC and do http request on web
Load file from the path and block until its loaded
Will use filesystem on PC and do http request on web
Load file from the path and block until its loaded Will use filesystem on PC and do http request on web
pub async fn load_file(path: &str) -> Result<Vec<u8>, FileError> {
    fn load_file_inner(path: &str) -> exec::FileLoadingFuture {
        use std::cell::RefCell;
        use std::rc::Rc;
        let contents = Rc::new(RefCell::new(None));
        let path = path.to_owned();
        {
            let contents = contents.clone();
            let err_path = path.clone();
            fs::load_file(&path, move |bytes| {
                *contents.borrow_mut() =
                    Some(bytes.map_err(|kind| FileError::new(kind, &err_path)));
            });
        }
        exec::FileLoadingFuture { contents }
    }
    load_file_inner(&get_path(path)).await
}
pub async fn load_file ( path : & str ) -> Result < Vec < u8 > , FileError > { fn load_file_inner ( path : & str ) -> exec :: FileLoadingFuture { use std :: cell :: RefCell ; use std :: rc :: Rc ; let contents = Rc :: new ( RefCell :: new ( None ) ) ; let path = path . to_owned ( ) ; { let contents = contents . clone ( ) ; let err_path = path . clone ( ) ; fs :: load_file ( & path , move | bytes | { * contents . borrow_mut ( ) = Some ( bytes . map_err ( | kind | FileError :: new ( kind , & err_path ) ) ) ; } ) ; } exec :: FileLoadingFuture { contents } } load_file_inner ( & get_path ( path ) ) . await }
Load file from the path and block until its loaded
Will use filesystem on PC and do http request on web
Load file from the path and block until its loaded Will use filesystem on PC and do http request on web
path
&str
path
&str