Skip to content

Commit 185e9db

Browse files
authored
Stabilize File System API (#3745)
1 parent bb94567 commit 185e9db

16 files changed

+5
-265
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
* Add bindings for `UserActivation`.
1212
[#3719](https://github.com/rustwasm/wasm-bindgen/pull/3719)
1313

14+
### Changed
15+
16+
* Stabilize File System API.
17+
[#3745](https://github.com/rustwasm/wasm-bindgen/pull/3745)
18+
1419
### Fixed
1520

1621
* Fixed a compiler error when using `#[wasm_bindgen]` inside `macro_rules!`.

crates/web-sys/src/features/gen_FileSystemCreateWritableOptions.rs

-13
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,27 @@
22
#![allow(clippy::all)]
33
use super::*;
44
use wasm_bindgen::prelude::*;
5-
#[cfg(web_sys_unstable_apis)]
65
#[wasm_bindgen]
76
extern "C" {
87
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = FileSystemCreateWritableOptions)]
98
#[derive(Debug, Clone, PartialEq, Eq)]
109
#[doc = "The `FileSystemCreateWritableOptions` dictionary."]
1110
#[doc = ""]
1211
#[doc = "*This API requires the following crate features to be activated: `FileSystemCreateWritableOptions`*"]
13-
#[doc = ""]
14-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
15-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
1612
pub type FileSystemCreateWritableOptions;
1713
}
18-
#[cfg(web_sys_unstable_apis)]
1914
impl FileSystemCreateWritableOptions {
2015
#[doc = "Construct a new `FileSystemCreateWritableOptions`."]
2116
#[doc = ""]
2217
#[doc = "*This API requires the following crate features to be activated: `FileSystemCreateWritableOptions`*"]
23-
#[doc = ""]
24-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
25-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
2618
pub fn new() -> Self {
2719
#[allow(unused_mut)]
2820
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
2921
ret
3022
}
31-
#[cfg(web_sys_unstable_apis)]
3223
#[doc = "Change the `keepExistingData` field of this object."]
3324
#[doc = ""]
3425
#[doc = "*This API requires the following crate features to be activated: `FileSystemCreateWritableOptions`*"]
35-
#[doc = ""]
36-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
37-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
3826
pub fn keep_existing_data(&mut self, val: bool) -> &mut Self {
3927
use wasm_bindgen::JsValue;
4028
let r = ::js_sys::Reflect::set(
@@ -50,7 +38,6 @@ impl FileSystemCreateWritableOptions {
5038
self
5139
}
5240
}
53-
#[cfg(web_sys_unstable_apis)]
5441
impl Default for FileSystemCreateWritableOptions {
5542
fn default() -> Self {
5643
Self::new()

crates/web-sys/src/features/gen_FileSystemDirectoryHandle.rs

-32
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#![allow(clippy::all)]
33
use super::*;
44
use wasm_bindgen::prelude::*;
5-
#[cfg(web_sys_unstable_apis)]
65
#[wasm_bindgen]
76
extern "C" {
87
# [wasm_bindgen (extends = FileSystemHandle , extends = :: js_sys :: Object , js_name = FileSystemDirectoryHandle , typescript_type = "FileSystemDirectoryHandle")]
@@ -12,101 +11,70 @@ extern "C" {
1211
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle)"]
1312
#[doc = ""]
1413
#[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`*"]
15-
#[doc = ""]
16-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
17-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
1814
pub type FileSystemDirectoryHandle;
19-
#[cfg(web_sys_unstable_apis)]
2015
# [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = getDirectoryHandle)]
2116
#[doc = "The `getDirectoryHandle()` method."]
2217
#[doc = ""]
2318
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/getDirectoryHandle)"]
2419
#[doc = ""]
2520
#[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`*"]
26-
#[doc = ""]
27-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
28-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
2921
pub fn get_directory_handle(this: &FileSystemDirectoryHandle, name: &str) -> ::js_sys::Promise;
30-
#[cfg(web_sys_unstable_apis)]
3122
#[cfg(feature = "FileSystemGetDirectoryOptions")]
3223
# [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = getDirectoryHandle)]
3324
#[doc = "The `getDirectoryHandle()` method."]
3425
#[doc = ""]
3526
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/getDirectoryHandle)"]
3627
#[doc = ""]
3728
#[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`, `FileSystemGetDirectoryOptions`*"]
38-
#[doc = ""]
39-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
40-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
4129
pub fn get_directory_handle_with_options(
4230
this: &FileSystemDirectoryHandle,
4331
name: &str,
4432
options: &FileSystemGetDirectoryOptions,
4533
) -> ::js_sys::Promise;
46-
#[cfg(web_sys_unstable_apis)]
4734
# [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = getFileHandle)]
4835
#[doc = "The `getFileHandle()` method."]
4936
#[doc = ""]
5037
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/getFileHandle)"]
5138
#[doc = ""]
5239
#[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`*"]
53-
#[doc = ""]
54-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
55-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
5640
pub fn get_file_handle(this: &FileSystemDirectoryHandle, name: &str) -> ::js_sys::Promise;
57-
#[cfg(web_sys_unstable_apis)]
5841
#[cfg(feature = "FileSystemGetFileOptions")]
5942
# [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = getFileHandle)]
6043
#[doc = "The `getFileHandle()` method."]
6144
#[doc = ""]
6245
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/getFileHandle)"]
6346
#[doc = ""]
6447
#[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`, `FileSystemGetFileOptions`*"]
65-
#[doc = ""]
66-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
67-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
6848
pub fn get_file_handle_with_options(
6949
this: &FileSystemDirectoryHandle,
7050
name: &str,
7151
options: &FileSystemGetFileOptions,
7252
) -> ::js_sys::Promise;
73-
#[cfg(web_sys_unstable_apis)]
7453
# [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = removeEntry)]
7554
#[doc = "The `removeEntry()` method."]
7655
#[doc = ""]
7756
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/removeEntry)"]
7857
#[doc = ""]
7958
#[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`*"]
80-
#[doc = ""]
81-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
82-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
8359
pub fn remove_entry(this: &FileSystemDirectoryHandle, name: &str) -> ::js_sys::Promise;
84-
#[cfg(web_sys_unstable_apis)]
8560
#[cfg(feature = "FileSystemRemoveOptions")]
8661
# [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = removeEntry)]
8762
#[doc = "The `removeEntry()` method."]
8863
#[doc = ""]
8964
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/removeEntry)"]
9065
#[doc = ""]
9166
#[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`, `FileSystemRemoveOptions`*"]
92-
#[doc = ""]
93-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
94-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
9567
pub fn remove_entry_with_options(
9668
this: &FileSystemDirectoryHandle,
9769
name: &str,
9870
options: &FileSystemRemoveOptions,
9971
) -> ::js_sys::Promise;
100-
#[cfg(web_sys_unstable_apis)]
10172
# [wasm_bindgen (method , structural , js_class = "FileSystemDirectoryHandle" , js_name = resolve)]
10273
#[doc = "The `resolve()` method."]
10374
#[doc = ""]
10475
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/resolve)"]
10576
#[doc = ""]
10677
#[doc = "*This API requires the following crate features to be activated: `FileSystemDirectoryHandle`*"]
107-
#[doc = ""]
108-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
109-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
11078
pub fn resolve(
11179
this: &FileSystemDirectoryHandle,
11280
possible_descendant: &FileSystemHandle,

crates/web-sys/src/features/gen_FileSystemFileHandle.rs

-20
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#![allow(clippy::all)]
33
use super::*;
44
use wasm_bindgen::prelude::*;
5-
#[cfg(web_sys_unstable_apis)]
65
#[wasm_bindgen]
76
extern "C" {
87
# [wasm_bindgen (extends = FileSystemHandle , extends = :: js_sys :: Object , js_name = FileSystemFileHandle , typescript_type = "FileSystemFileHandle")]
@@ -12,56 +11,37 @@ extern "C" {
1211
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle)"]
1312
#[doc = ""]
1413
#[doc = "*This API requires the following crate features to be activated: `FileSystemFileHandle`*"]
15-
#[doc = ""]
16-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
17-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
1814
pub type FileSystemFileHandle;
19-
#[cfg(web_sys_unstable_apis)]
2015
# [wasm_bindgen (method , structural , js_class = "FileSystemFileHandle" , js_name = createSyncAccessHandle)]
2116
#[doc = "The `createSyncAccessHandle()` method."]
2217
#[doc = ""]
2318
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle/createSyncAccessHandle)"]
2419
#[doc = ""]
2520
#[doc = "*This API requires the following crate features to be activated: `FileSystemFileHandle`*"]
26-
#[doc = ""]
27-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
28-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
2921
pub fn create_sync_access_handle(this: &FileSystemFileHandle) -> ::js_sys::Promise;
30-
#[cfg(web_sys_unstable_apis)]
3122
# [wasm_bindgen (method , structural , js_class = "FileSystemFileHandle" , js_name = createWritable)]
3223
#[doc = "The `createWritable()` method."]
3324
#[doc = ""]
3425
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle/createWritable)"]
3526
#[doc = ""]
3627
#[doc = "*This API requires the following crate features to be activated: `FileSystemFileHandle`*"]
37-
#[doc = ""]
38-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
39-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
4028
pub fn create_writable(this: &FileSystemFileHandle) -> ::js_sys::Promise;
41-
#[cfg(web_sys_unstable_apis)]
4229
#[cfg(feature = "FileSystemCreateWritableOptions")]
4330
# [wasm_bindgen (method , structural , js_class = "FileSystemFileHandle" , js_name = createWritable)]
4431
#[doc = "The `createWritable()` method."]
4532
#[doc = ""]
4633
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle/createWritable)"]
4734
#[doc = ""]
4835
#[doc = "*This API requires the following crate features to be activated: `FileSystemCreateWritableOptions`, `FileSystemFileHandle`*"]
49-
#[doc = ""]
50-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
51-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
5236
pub fn create_writable_with_options(
5337
this: &FileSystemFileHandle,
5438
options: &FileSystemCreateWritableOptions,
5539
) -> ::js_sys::Promise;
56-
#[cfg(web_sys_unstable_apis)]
5740
# [wasm_bindgen (method , structural , js_class = "FileSystemFileHandle" , js_name = getFile)]
5841
#[doc = "The `getFile()` method."]
5942
#[doc = ""]
6043
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle/getFile)"]
6144
#[doc = ""]
6245
#[doc = "*This API requires the following crate features to be activated: `FileSystemFileHandle`*"]
63-
#[doc = ""]
64-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
65-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
6646
pub fn get_file(this: &FileSystemFileHandle) -> ::js_sys::Promise;
6747
}

crates/web-sys/src/features/gen_FileSystemGetDirectoryOptions.rs

-13
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,27 @@
22
#![allow(clippy::all)]
33
use super::*;
44
use wasm_bindgen::prelude::*;
5-
#[cfg(web_sys_unstable_apis)]
65
#[wasm_bindgen]
76
extern "C" {
87
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = FileSystemGetDirectoryOptions)]
98
#[derive(Debug, Clone, PartialEq, Eq)]
109
#[doc = "The `FileSystemGetDirectoryOptions` dictionary."]
1110
#[doc = ""]
1211
#[doc = "*This API requires the following crate features to be activated: `FileSystemGetDirectoryOptions`*"]
13-
#[doc = ""]
14-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
15-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
1612
pub type FileSystemGetDirectoryOptions;
1713
}
18-
#[cfg(web_sys_unstable_apis)]
1914
impl FileSystemGetDirectoryOptions {
2015
#[doc = "Construct a new `FileSystemGetDirectoryOptions`."]
2116
#[doc = ""]
2217
#[doc = "*This API requires the following crate features to be activated: `FileSystemGetDirectoryOptions`*"]
23-
#[doc = ""]
24-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
25-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
2618
pub fn new() -> Self {
2719
#[allow(unused_mut)]
2820
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
2921
ret
3022
}
31-
#[cfg(web_sys_unstable_apis)]
3223
#[doc = "Change the `create` field of this object."]
3324
#[doc = ""]
3425
#[doc = "*This API requires the following crate features to be activated: `FileSystemGetDirectoryOptions`*"]
35-
#[doc = ""]
36-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
37-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
3826
pub fn create(&mut self, val: bool) -> &mut Self {
3927
use wasm_bindgen::JsValue;
4028
let r =
@@ -47,7 +35,6 @@ impl FileSystemGetDirectoryOptions {
4735
self
4836
}
4937
}
50-
#[cfg(web_sys_unstable_apis)]
5138
impl Default for FileSystemGetDirectoryOptions {
5239
fn default() -> Self {
5340
Self::new()

crates/web-sys/src/features/gen_FileSystemGetFileOptions.rs

-13
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,27 @@
22
#![allow(clippy::all)]
33
use super::*;
44
use wasm_bindgen::prelude::*;
5-
#[cfg(web_sys_unstable_apis)]
65
#[wasm_bindgen]
76
extern "C" {
87
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = FileSystemGetFileOptions)]
98
#[derive(Debug, Clone, PartialEq, Eq)]
109
#[doc = "The `FileSystemGetFileOptions` dictionary."]
1110
#[doc = ""]
1211
#[doc = "*This API requires the following crate features to be activated: `FileSystemGetFileOptions`*"]
13-
#[doc = ""]
14-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
15-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
1612
pub type FileSystemGetFileOptions;
1713
}
18-
#[cfg(web_sys_unstable_apis)]
1914
impl FileSystemGetFileOptions {
2015
#[doc = "Construct a new `FileSystemGetFileOptions`."]
2116
#[doc = ""]
2217
#[doc = "*This API requires the following crate features to be activated: `FileSystemGetFileOptions`*"]
23-
#[doc = ""]
24-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
25-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
2618
pub fn new() -> Self {
2719
#[allow(unused_mut)]
2820
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
2921
ret
3022
}
31-
#[cfg(web_sys_unstable_apis)]
3223
#[doc = "Change the `create` field of this object."]
3324
#[doc = ""]
3425
#[doc = "*This API requires the following crate features to be activated: `FileSystemGetFileOptions`*"]
35-
#[doc = ""]
36-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
37-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
3826
pub fn create(&mut self, val: bool) -> &mut Self {
3927
use wasm_bindgen::JsValue;
4028
let r =
@@ -47,7 +35,6 @@ impl FileSystemGetFileOptions {
4735
self
4836
}
4937
}
50-
#[cfg(web_sys_unstable_apis)]
5138
impl Default for FileSystemGetFileOptions {
5239
fn default() -> Self {
5340
Self::new()

0 commit comments

Comments
 (0)