Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize File System API #3745

Merged
merged 1 commit into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
* Add bindings for `UserActivation`.
[#3719](https://github.com/rustwasm/wasm-bindgen/pull/3719)

### Changed

* Stabilize File System API.
[#3745](https://github.com/rustwasm/wasm-bindgen/pull/3745)

### Fixed

* Fixed a compiler error when using `#[wasm_bindgen]` inside `macro_rules!`.
Expand Down
13 changes: 0 additions & 13 deletions crates/web-sys/src/features/gen_FileSystemCreateWritableOptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,27 @@
#![allow(clippy::all)]
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(
Expand All @@ -50,7 +38,6 @@ impl FileSystemCreateWritableOptions {
self
}
}
#[cfg(web_sys_unstable_apis)]
impl Default for FileSystemCreateWritableOptions {
fn default() -> Self {
Self::new()
Expand Down
32 changes: 0 additions & 32 deletions crates/web-sys/src/features/gen_FileSystemDirectoryHandle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#![allow(clippy::all)]
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")]
Expand All @@ -12,101 +11,70 @@ extern "C" {
#[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,
Expand Down
20 changes: 0 additions & 20 deletions crates/web-sys/src/features/gen_FileSystemFileHandle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#![allow(clippy::all)]
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")]
Expand All @@ -12,56 +11,37 @@ extern "C" {
#[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;
}
13 changes: 0 additions & 13 deletions crates/web-sys/src/features/gen_FileSystemGetDirectoryOptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,27 @@
#![allow(clippy::all)]
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 =
Expand All @@ -47,7 +35,6 @@ impl FileSystemGetDirectoryOptions {
self
}
}
#[cfg(web_sys_unstable_apis)]
impl Default for FileSystemGetDirectoryOptions {
fn default() -> Self {
Self::new()
Expand Down
13 changes: 0 additions & 13 deletions crates/web-sys/src/features/gen_FileSystemGetFileOptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,27 @@
#![allow(clippy::all)]
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 =
Expand All @@ -47,7 +35,6 @@ impl FileSystemGetFileOptions {
self
}
}
#[cfg(web_sys_unstable_apis)]
impl Default for FileSystemGetFileOptions {
fn default() -> Self {
Self::new()
Expand Down
Loading