Skip to content

Commit 6d80c33

Browse files
committed
get rid of separate FileList struct
1 parent beef8f5 commit 6d80c33

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

rfcs/001-mid-level-file-api.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,12 @@ The mid-level file API aims to implement File I/O on top of the raw JS apis foun
88

99
## The API
1010

11-
First we have `FileList` which is simply a list of `File`s. This is an opaque struct that offers a way to iterate over `Files` and get individual files by index:
11+
First we have a way to turn a `web_sys::FileList` into a vector of `File`s (we'll look a the `File` struct below):
1212

1313
```rust
14-
#[derive(Debug, Clone)]
15-
struct FileList { ... }
16-
17-
impl FileList {
18-
fn get(index: u32) -> Option<File> { ... }
19-
20-
fn len(&self) -> u32 { ... }
21-
22-
fn iter(&self) -> FileListIter { ... }
23-
24-
fn as_raw(&self) -> &web_sys::FileList { ... }
25-
}
26-
27-
impl AsRef<web_sys::FileList> for FileList { ... }
28-
impl From<web_sys::FileList> for FileList { ... }
29-
impl Index<usize> for FileList {
30-
type Output = File;
31-
fn index(&self, index: usize) -> &Self::Output { ... }
32-
}
14+
impl From<web_sys::FileList> for Vec<File> { ... }
3315
```
3416

35-
There is no `FileList::new` since creating a raw `web_sys::FileList` is not possible without going through a `web_sys::HtmlInputElement`.
36-
3717
Next we the trait `BlobLike`
3818
```rust
3919
trait BlobLike {

0 commit comments

Comments
 (0)