diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 704cf02b16a..2f7246d8a7a 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -382,13 +382,24 @@ FilePropertyBag = [] FileReader = ["EventTarget"] FileReaderSync = [] FileSystem = [] +FileSystemCreateWritableOptions = [] FileSystemDirectoryEntry = ["FileSystemEntry"] +FileSystemDirectoryHandle = ["FileSystemHandle"] FileSystemDirectoryReader = [] FileSystemEntriesCallback = [] FileSystemEntry = [] FileSystemEntryCallback = [] FileSystemFileEntry = ["FileSystemEntry"] +FileSystemFileHandle = ["FileSystemHandle"] FileSystemFlags = [] +FileSystemGetDirectoryOptions = [] +FileSystemGetFileOptions = [] +FileSystemHandle = [] +FileSystemHandleKind = [] +FileSystemReadWriteOptions = [] +FileSystemRemoveOptions = [] +FileSystemSyncAccessHandle = [] +FileSystemWritableFileStream = ["WritableStream"] FillMode = [] FlashClassification = [] FlexLineGrowthState = [] @@ -1526,6 +1537,8 @@ WorkletOptions = [] WritableStream = [] WritableStreamDefaultController = [] WritableStreamDefaultWriter = [] +WriteCommandType = [] +WriteParams = [] XPathExpression = [] XPathNsResolver = [] XPathResult = [] diff --git a/crates/web-sys/src/features/gen_FileSystemCreateWritableOptions.rs b/crates/web-sys/src/features/gen_FileSystemCreateWritableOptions.rs new file mode 100644 index 00000000000..ad28434e900 --- /dev/null +++ b/crates/web-sys/src/features/gen_FileSystemCreateWritableOptions.rs @@ -0,0 +1,57 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = FileSystemCreateWritableOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `FileSystemCreateWritableOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemCreateWritableOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type FileSystemCreateWritableOptions; +} +#[cfg(web_sys_unstable_apis)] +impl FileSystemCreateWritableOptions { + #[doc = "Construct a new `FileSystemCreateWritableOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemCreateWritableOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `keepExistingData` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemCreateWritableOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn keep_existing_data(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("keepExistingData"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for FileSystemCreateWritableOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_FileSystemDirectoryHandle.rs b/crates/web-sys/src/features/gen_FileSystemDirectoryHandle.rs new file mode 100644 index 00000000000..b9092fd6e00 --- /dev/null +++ b/crates/web-sys/src/features/gen_FileSystemDirectoryHandle.rs @@ -0,0 +1,113 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = FileSystemHandle , extends = :: js_sys :: Object , js_name = FileSystemDirectoryHandle , typescript_type = "FileSystemDirectoryHandle")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `FileSystemDirectoryHandle` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type FileSystemDirectoryHandle; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = getDirectoryHandle)] + #[doc = "The `getDirectoryHandle()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/getDirectoryHandle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_directory_handle(this: &FileSystemDirectoryHandle, name: &str) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemGetDirectoryOptions")] + # [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = getDirectoryHandle)] + #[doc = "The `getDirectoryHandle()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/getDirectoryHandle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`, `FileSystemGetDirectoryOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_directory_handle_with_options( + this: &FileSystemDirectoryHandle, + name: &str, + options: &FileSystemGetDirectoryOptions, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = getFileHandle)] + #[doc = "The `getFileHandle()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/getFileHandle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_file_handle(this: &FileSystemDirectoryHandle, name: &str) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemGetFileOptions")] + # [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = getFileHandle)] + #[doc = "The `getFileHandle()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/getFileHandle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`, `FileSystemGetFileOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_file_handle_with_options( + this: &FileSystemDirectoryHandle, + name: &str, + options: &FileSystemGetFileOptions, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = removeEntry)] + #[doc = "The `removeEntry()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/removeEntry)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn remove_entry(this: &FileSystemDirectoryHandle, name: &str) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemRemoveOptions")] + # [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = removeEntry)] + #[doc = "The `removeEntry()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/removeEntry)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`, `FileSystemRemoveOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn remove_entry_with_options( + this: &FileSystemDirectoryHandle, + name: &str, + options: &FileSystemRemoveOptions, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = resolve)] + #[doc = "The `resolve()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/resolve)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn resolve( + this: &FileSystemDirectoryHandle, + possible_descendant: &FileSystemHandle, + ) -> ::js_sys::Promise; +} diff --git a/crates/web-sys/src/features/gen_FileSystemFileHandle.rs b/crates/web-sys/src/features/gen_FileSystemFileHandle.rs new file mode 100644 index 00000000000..af16b279ad5 --- /dev/null +++ b/crates/web-sys/src/features/gen_FileSystemFileHandle.rs @@ -0,0 +1,66 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = FileSystemHandle , extends = :: js_sys :: Object , js_name = FileSystemFileHandle , typescript_type = "FileSystemFileHandle")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `FileSystemFileHandle` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemFileHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type FileSystemFileHandle; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "FileSystemFileHandle" , js_name = createSyncAccessHandle)] + #[doc = "The `createSyncAccessHandle()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle/createSyncAccessHandle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemFileHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_sync_access_handle(this: &FileSystemFileHandle) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "FileSystemFileHandle" , js_name = createWritable)] + #[doc = "The `createWritable()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle/createWritable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemFileHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_writable(this: &FileSystemFileHandle) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemCreateWritableOptions")] + # [wasm_bindgen (method , structural , js_class = "FileSystemFileHandle" , js_name = createWritable)] + #[doc = "The `createWritable()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle/createWritable)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemCreateWritableOptions`, `FileSystemFileHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_writable_with_options( + this: &FileSystemFileHandle, + options: &FileSystemCreateWritableOptions, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "FileSystemFileHandle" , js_name = getFile)] + #[doc = "The `getFile()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle/getFile)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemFileHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_file(this: &FileSystemFileHandle) -> ::js_sys::Promise; +} diff --git a/crates/web-sys/src/features/gen_FileSystemGetDirectoryOptions.rs b/crates/web-sys/src/features/gen_FileSystemGetDirectoryOptions.rs new file mode 100644 index 00000000000..c971fbe4841 --- /dev/null +++ b/crates/web-sys/src/features/gen_FileSystemGetDirectoryOptions.rs @@ -0,0 +1,54 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = FileSystemGetDirectoryOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `FileSystemGetDirectoryOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemGetDirectoryOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type FileSystemGetDirectoryOptions; +} +#[cfg(web_sys_unstable_apis)] +impl FileSystemGetDirectoryOptions { + #[doc = "Construct a new `FileSystemGetDirectoryOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemGetDirectoryOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `create` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemGetDirectoryOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("create"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for FileSystemGetDirectoryOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_FileSystemGetFileOptions.rs b/crates/web-sys/src/features/gen_FileSystemGetFileOptions.rs new file mode 100644 index 00000000000..bda0bec4e87 --- /dev/null +++ b/crates/web-sys/src/features/gen_FileSystemGetFileOptions.rs @@ -0,0 +1,54 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = FileSystemGetFileOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `FileSystemGetFileOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemGetFileOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type FileSystemGetFileOptions; +} +#[cfg(web_sys_unstable_apis)] +impl FileSystemGetFileOptions { + #[doc = "Construct a new `FileSystemGetFileOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemGetFileOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `create` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemGetFileOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("create"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for FileSystemGetFileOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_FileSystemHandle.rs b/crates/web-sys/src/features/gen_FileSystemHandle.rs new file mode 100644 index 00000000000..602999b7100 --- /dev/null +++ b/crates/web-sys/src/features/gen_FileSystemHandle.rs @@ -0,0 +1,52 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = FileSystemHandle , typescript_type = "FileSystemHandle")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `FileSystemHandle` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type FileSystemHandle; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemHandleKind")] + # [wasm_bindgen (structural , method , getter , js_class = "FileSystemHandle" , js_name = kind)] + #[doc = "Getter for the `kind` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/kind)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandle`, `FileSystemHandleKind`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn kind(this: &FileSystemHandle) -> FileSystemHandleKind; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "FileSystemHandle" , js_name = name)] + #[doc = "Getter for the `name` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/name)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn name(this: &FileSystemHandle) -> String; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "FileSystemHandle" , js_name = isSameEntry)] + #[doc = "The `isSameEntry()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/isSameEntry)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn is_same_entry(this: &FileSystemHandle, other: &FileSystemHandle) -> ::js_sys::Promise; +} diff --git a/crates/web-sys/src/features/gen_FileSystemHandleKind.rs b/crates/web-sys/src/features/gen_FileSystemHandleKind.rs new file mode 100644 index 00000000000..7165864dd42 --- /dev/null +++ b/crates/web-sys/src/features/gen_FileSystemHandleKind.rs @@ -0,0 +1,15 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `FileSystemHandleKind` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `FileSystemHandleKind`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum FileSystemHandleKind { + File = "file", + Directory = "directory", +} diff --git a/crates/web-sys/src/features/gen_FileSystemReadWriteOptions.rs b/crates/web-sys/src/features/gen_FileSystemReadWriteOptions.rs new file mode 100644 index 00000000000..b3b2b8125d6 --- /dev/null +++ b/crates/web-sys/src/features/gen_FileSystemReadWriteOptions.rs @@ -0,0 +1,53 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = FileSystemReadWriteOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `FileSystemReadWriteOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemReadWriteOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type FileSystemReadWriteOptions; +} +#[cfg(web_sys_unstable_apis)] +impl FileSystemReadWriteOptions { + #[doc = "Construct a new `FileSystemReadWriteOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemReadWriteOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `at` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemReadWriteOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn at(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("at"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for FileSystemReadWriteOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_FileSystemRemoveOptions.rs b/crates/web-sys/src/features/gen_FileSystemRemoveOptions.rs new file mode 100644 index 00000000000..bc25023fb7f --- /dev/null +++ b/crates/web-sys/src/features/gen_FileSystemRemoveOptions.rs @@ -0,0 +1,57 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = FileSystemRemoveOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `FileSystemRemoveOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemRemoveOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type FileSystemRemoveOptions; +} +#[cfg(web_sys_unstable_apis)] +impl FileSystemRemoveOptions { + #[doc = "Construct a new `FileSystemRemoveOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemRemoveOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `recursive` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemRemoveOptions`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn recursive(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("recursive"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for FileSystemRemoveOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_FileSystemSyncAccessHandle.rs b/crates/web-sys/src/features/gen_FileSystemSyncAccessHandle.rs new file mode 100644 index 00000000000..8bc8224c59e --- /dev/null +++ b/crates/web-sys/src/features/gen_FileSystemSyncAccessHandle.rs @@ -0,0 +1,199 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = FileSystemSyncAccessHandle , typescript_type = "FileSystemSyncAccessHandle")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `FileSystemSyncAccessHandle` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemSyncAccessHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type FileSystemSyncAccessHandle; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = close)] + #[doc = "The `close()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/close)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemSyncAccessHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn close(this: &FileSystemSyncAccessHandle); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = flush)] + #[doc = "The `flush()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/flush)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemSyncAccessHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn flush(this: &FileSystemSyncAccessHandle) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = getSize)] + #[doc = "The `getSize()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/getSize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemSyncAccessHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_size(this: &FileSystemSyncAccessHandle) -> Result; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = read)] + #[doc = "The `read()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/read)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemSyncAccessHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn read_with_buffer_source( + this: &FileSystemSyncAccessHandle, + buffer: &::js_sys::Object, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = read)] + #[doc = "The `read()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/read)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemSyncAccessHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn read_with_u8_array( + this: &FileSystemSyncAccessHandle, + buffer: &mut [u8], + ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemReadWriteOptions")] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = read)] + #[doc = "The `read()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/read)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemReadWriteOptions`, `FileSystemSyncAccessHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn read_with_buffer_source_and_options( + this: &FileSystemSyncAccessHandle, + buffer: &::js_sys::Object, + options: &FileSystemReadWriteOptions, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemReadWriteOptions")] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = read)] + #[doc = "The `read()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/read)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemReadWriteOptions`, `FileSystemSyncAccessHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn read_with_u8_array_and_options( + this: &FileSystemSyncAccessHandle, + buffer: &mut [u8], + options: &FileSystemReadWriteOptions, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = truncate)] + #[doc = "The `truncate()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/truncate)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemSyncAccessHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn truncate_with_u32( + this: &FileSystemSyncAccessHandle, + new_size: u32, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = truncate)] + #[doc = "The `truncate()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/truncate)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemSyncAccessHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn truncate_with_f64( + this: &FileSystemSyncAccessHandle, + new_size: f64, + ) -> Result<(), JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = write)] + #[doc = "The `write()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/write)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemSyncAccessHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_with_buffer_source( + this: &FileSystemSyncAccessHandle, + buffer: &::js_sys::Object, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = write)] + #[doc = "The `write()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/write)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemSyncAccessHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_with_u8_array( + this: &FileSystemSyncAccessHandle, + buffer: &mut [u8], + ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemReadWriteOptions")] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = write)] + #[doc = "The `write()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/write)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemReadWriteOptions`, `FileSystemSyncAccessHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_with_buffer_source_and_options( + this: &FileSystemSyncAccessHandle, + buffer: &::js_sys::Object, + options: &FileSystemReadWriteOptions, + ) -> Result; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "FileSystemReadWriteOptions")] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemSyncAccessHandle" , js_name = write)] + #[doc = "The `write()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/write)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemReadWriteOptions`, `FileSystemSyncAccessHandle`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_with_u8_array_and_options( + this: &FileSystemSyncAccessHandle, + buffer: &mut [u8], + options: &FileSystemReadWriteOptions, + ) -> Result; +} diff --git a/crates/web-sys/src/features/gen_FileSystemWritableFileStream.rs b/crates/web-sys/src/features/gen_FileSystemWritableFileStream.rs new file mode 100644 index 00000000000..fdc461253ec --- /dev/null +++ b/crates/web-sys/src/features/gen_FileSystemWritableFileStream.rs @@ -0,0 +1,146 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = WritableStream , extends = :: js_sys :: Object , js_name = FileSystemWritableFileStream , typescript_type = "FileSystemWritableFileStream")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `FileSystemWritableFileStream` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemWritableFileStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type FileSystemWritableFileStream; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemWritableFileStream" , js_name = seek)] + #[doc = "The `seek()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/seek)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemWritableFileStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn seek_with_u32( + this: &FileSystemWritableFileStream, + position: u32, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemWritableFileStream" , js_name = seek)] + #[doc = "The `seek()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/seek)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemWritableFileStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn seek_with_f64( + this: &FileSystemWritableFileStream, + position: f64, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemWritableFileStream" , js_name = truncate)] + #[doc = "The `truncate()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/truncate)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemWritableFileStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn truncate_with_u32( + this: &FileSystemWritableFileStream, + size: u32, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemWritableFileStream" , js_name = truncate)] + #[doc = "The `truncate()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/truncate)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemWritableFileStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn truncate_with_f64( + this: &FileSystemWritableFileStream, + size: f64, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemWritableFileStream" , js_name = write)] + #[doc = "The `write()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/write)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemWritableFileStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_with_buffer_source( + this: &FileSystemWritableFileStream, + data: &::js_sys::Object, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemWritableFileStream" , js_name = write)] + #[doc = "The `write()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/write)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemWritableFileStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_with_u8_array( + this: &FileSystemWritableFileStream, + data: &mut [u8], + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "Blob")] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemWritableFileStream" , js_name = write)] + #[doc = "The `write()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/write)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Blob`, `FileSystemWritableFileStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_with_blob( + this: &FileSystemWritableFileStream, + data: &Blob, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemWritableFileStream" , js_name = write)] + #[doc = "The `write()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/write)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemWritableFileStream`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_with_str( + this: &FileSystemWritableFileStream, + data: &str, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WriteParams")] + # [wasm_bindgen (catch , method , structural , js_class = "FileSystemWritableFileStream" , js_name = write)] + #[doc = "The `write()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/write)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `FileSystemWritableFileStream`, `WriteParams`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn write_with_write_params( + this: &FileSystemWritableFileStream, + data: &WriteParams, + ) -> Result<::js_sys::Promise, JsValue>; +} diff --git a/crates/web-sys/src/features/gen_StorageManager.rs b/crates/web-sys/src/features/gen_StorageManager.rs index 9901c79509c..9d76bd3f929 100644 --- a/crates/web-sys/src/features/gen_StorageManager.rs +++ b/crates/web-sys/src/features/gen_StorageManager.rs @@ -18,6 +18,17 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `StorageManager`*"] pub fn estimate(this: &StorageManager) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "StorageManager" , js_name = getDirectory)] + #[doc = "The `getDirectory()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/StorageManager/getDirectory)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `StorageManager`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn get_directory(this: &StorageManager) -> ::js_sys::Promise; # [wasm_bindgen (catch , method , structural , js_class = "StorageManager" , js_name = persist)] #[doc = "The `persist()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_WriteCommandType.rs b/crates/web-sys/src/features/gen_WriteCommandType.rs new file mode 100644 index 00000000000..68a413d7a2e --- /dev/null +++ b/crates/web-sys/src/features/gen_WriteCommandType.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `WriteCommandType` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `WriteCommandType`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum WriteCommandType { + Write = "write", + Seek = "seek", + Truncate = "truncate", +} diff --git a/crates/web-sys/src/features/gen_WriteParams.rs b/crates/web-sys/src/features/gen_WriteParams.rs new file mode 100644 index 00000000000..85c346bd226 --- /dev/null +++ b/crates/web-sys/src/features/gen_WriteParams.rs @@ -0,0 +1,105 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WriteParams)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `WriteParams` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type WriteParams; +} +#[cfg(web_sys_unstable_apis)] +impl WriteParams { + #[cfg(feature = "WriteCommandType")] + #[doc = "Construct a new `WriteParams`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WriteCommandType`, `WriteParams`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new(type_: WriteCommandType) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.type_(type_); + ret + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `data` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn data(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `position` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn position(&mut self, val: Option) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("position"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `size` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WriteParams`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn size(&mut self, val: Option) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("size"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "WriteCommandType")] + #[doc = "Change the `type` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `WriteCommandType`, `WriteParams`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn type_(&mut self, val: WriteCommandType) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 74b67838508..e56624a0f6f 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -2110,12 +2110,24 @@ mod gen_FileSystem; #[cfg(feature = "FileSystem")] pub use gen_FileSystem::*; +#[cfg(feature = "FileSystemCreateWritableOptions")] +#[allow(non_snake_case)] +mod gen_FileSystemCreateWritableOptions; +#[cfg(feature = "FileSystemCreateWritableOptions")] +pub use gen_FileSystemCreateWritableOptions::*; + #[cfg(feature = "FileSystemDirectoryEntry")] #[allow(non_snake_case)] mod gen_FileSystemDirectoryEntry; #[cfg(feature = "FileSystemDirectoryEntry")] pub use gen_FileSystemDirectoryEntry::*; +#[cfg(feature = "FileSystemDirectoryHandle")] +#[allow(non_snake_case)] +mod gen_FileSystemDirectoryHandle; +#[cfg(feature = "FileSystemDirectoryHandle")] +pub use gen_FileSystemDirectoryHandle::*; + #[cfg(feature = "FileSystemDirectoryReader")] #[allow(non_snake_case)] mod gen_FileSystemDirectoryReader; @@ -2146,12 +2158,66 @@ mod gen_FileSystemFileEntry; #[cfg(feature = "FileSystemFileEntry")] pub use gen_FileSystemFileEntry::*; +#[cfg(feature = "FileSystemFileHandle")] +#[allow(non_snake_case)] +mod gen_FileSystemFileHandle; +#[cfg(feature = "FileSystemFileHandle")] +pub use gen_FileSystemFileHandle::*; + #[cfg(feature = "FileSystemFlags")] #[allow(non_snake_case)] mod gen_FileSystemFlags; #[cfg(feature = "FileSystemFlags")] pub use gen_FileSystemFlags::*; +#[cfg(feature = "FileSystemGetDirectoryOptions")] +#[allow(non_snake_case)] +mod gen_FileSystemGetDirectoryOptions; +#[cfg(feature = "FileSystemGetDirectoryOptions")] +pub use gen_FileSystemGetDirectoryOptions::*; + +#[cfg(feature = "FileSystemGetFileOptions")] +#[allow(non_snake_case)] +mod gen_FileSystemGetFileOptions; +#[cfg(feature = "FileSystemGetFileOptions")] +pub use gen_FileSystemGetFileOptions::*; + +#[cfg(feature = "FileSystemHandle")] +#[allow(non_snake_case)] +mod gen_FileSystemHandle; +#[cfg(feature = "FileSystemHandle")] +pub use gen_FileSystemHandle::*; + +#[cfg(feature = "FileSystemHandleKind")] +#[allow(non_snake_case)] +mod gen_FileSystemHandleKind; +#[cfg(feature = "FileSystemHandleKind")] +pub use gen_FileSystemHandleKind::*; + +#[cfg(feature = "FileSystemReadWriteOptions")] +#[allow(non_snake_case)] +mod gen_FileSystemReadWriteOptions; +#[cfg(feature = "FileSystemReadWriteOptions")] +pub use gen_FileSystemReadWriteOptions::*; + +#[cfg(feature = "FileSystemRemoveOptions")] +#[allow(non_snake_case)] +mod gen_FileSystemRemoveOptions; +#[cfg(feature = "FileSystemRemoveOptions")] +pub use gen_FileSystemRemoveOptions::*; + +#[cfg(feature = "FileSystemSyncAccessHandle")] +#[allow(non_snake_case)] +mod gen_FileSystemSyncAccessHandle; +#[cfg(feature = "FileSystemSyncAccessHandle")] +pub use gen_FileSystemSyncAccessHandle::*; + +#[cfg(feature = "FileSystemWritableFileStream")] +#[allow(non_snake_case)] +mod gen_FileSystemWritableFileStream; +#[cfg(feature = "FileSystemWritableFileStream")] +pub use gen_FileSystemWritableFileStream::*; + #[cfg(feature = "FillMode")] #[allow(non_snake_case)] mod gen_FillMode; @@ -8974,6 +9040,18 @@ mod gen_WritableStreamDefaultWriter; #[cfg(feature = "WritableStreamDefaultWriter")] pub use gen_WritableStreamDefaultWriter::*; +#[cfg(feature = "WriteCommandType")] +#[allow(non_snake_case)] +mod gen_WriteCommandType; +#[cfg(feature = "WriteCommandType")] +pub use gen_WriteCommandType::*; + +#[cfg(feature = "WriteParams")] +#[allow(non_snake_case)] +mod gen_WriteParams; +#[cfg(feature = "WriteParams")] +pub use gen_WriteParams::*; + #[cfg(feature = "XPathExpression")] #[allow(non_snake_case)] mod gen_XPathExpression; diff --git a/crates/web-sys/webidls/unstable/FileSystemAccess.webidl b/crates/web-sys/webidls/unstable/FileSystemAccess.webidl new file mode 100644 index 00000000000..cc5623bdb19 --- /dev/null +++ b/crates/web-sys/webidls/unstable/FileSystemAccess.webidl @@ -0,0 +1,101 @@ +enum FileSystemHandleKind { + "file", + "directory", +}; + +[Exposed=(Window,Worker), SecureContext, Serializable] +interface FileSystemHandle { + readonly attribute FileSystemHandleKind kind; + readonly attribute USVString name; + + Promise isSameEntry(FileSystemHandle other); +}; + +dictionary FileSystemCreateWritableOptions { + boolean keepExistingData = false; +}; + +[Exposed=(Window,Worker), SecureContext, Serializable] +interface FileSystemFileHandle : FileSystemHandle { + Promise getFile(); + Promise createWritable(optional FileSystemCreateWritableOptions options = {}); + [Exposed=DedicatedWorker] + Promise createSyncAccessHandle(); +}; + +dictionary FileSystemGetFileOptions { + boolean create = false; +}; + +dictionary FileSystemGetDirectoryOptions { + boolean create = false; +}; + +dictionary FileSystemRemoveOptions { + boolean recursive = false; +}; + +[Exposed=(Window,Worker), SecureContext, Serializable] +interface FileSystemDirectoryHandle : FileSystemHandle { + async iterable; + + Promise getFileHandle(USVString name, optional FileSystemGetFileOptions options = {}); + Promise getDirectoryHandle(USVString name, optional FileSystemGetDirectoryOptions options = {}); + + Promise removeEntry(USVString name, optional FileSystemRemoveOptions options = {}); + + Promise?> resolve(FileSystemHandle possibleDescendant); +}; + +enum WriteCommandType { + "write", + "seek", + "truncate", +}; + +dictionary WriteParams { + required WriteCommandType type; + unsigned long long? size; + unsigned long long? position; + (BufferSource or Blob or USVString)? data; +}; + +typedef (BufferSource or Blob or USVString or WriteParams) FileSystemWriteChunkType; + +[Exposed=(Window,Worker), SecureContext] +interface FileSystemWritableFileStream : WritableStream { + [Throws] + Promise write(FileSystemWriteChunkType data); + [Throws] + Promise seek(unsigned long long position); + [Throws] + Promise truncate(unsigned long long size); +}; + +dictionary FileSystemReadWriteOptions { + [EnforceRange] unsigned long long at; +}; + +[Exposed=DedicatedWorker, SecureContext] +interface FileSystemSyncAccessHandle { + [Throws] + unsigned long long read([AllowShared] BufferSource buffer, + optional FileSystemReadWriteOptions options = {}); + [Throws] + unsigned long long write([AllowShared] BufferSource buffer, + optional FileSystemReadWriteOptions options = {}); + + [Throws] + undefined truncate([EnforceRange] unsigned long long newSize); + [Throws] + unsigned long long getSize(); + [Throws] + undefined flush(); + undefined close(); +}; + + +[SecureContext] +partial interface StorageManager { + Promise getDirectory(); +};