Implemented fs module (#19)

This commit is contained in:
bicarlsen 2023-09-10 09:24:27 +02:00 committed by GitHub
parent 36c873b825
commit 55fe1d144f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 535 additions and 13 deletions

View file

@ -1,6 +1,6 @@
use std::path::PathBuf;
use wasm_bindgen::JsValue;
#[derive(Clone, Eq, PartialEq, Debug, thiserror::Error)]
pub enum Error {
#[error("JS Binding: {0}")]
@ -9,7 +9,10 @@ pub enum Error {
Serde(String),
#[cfg(any(feature = "event", feature = "window"))]
#[error("Oneshot cancelled: {0}")]
OneshotCanceled(#[from] futures::channel::oneshot::Canceled)
OneshotCanceled(#[from] futures::channel::oneshot::Canceled),
#[cfg(feature = "fs")]
#[error("could not convert path to string")]
Utf8(PathBuf),
}
impl From<serde_wasm_bindgen::Error> for Error {
@ -22,4 +25,4 @@ impl From<JsValue> for Error {
fn from(e: JsValue) -> Self {
Self::Binding(format!("{:?}", e))
}
}
}