Description
Right now there's a whole bunch of methods for creating a new Blob:
new_with_buffer_source_sequence
new_with_u8_array_sequence
new_with_blob_sequence
new_with_str_sequence
new_with_buffer_source_sequence_and_options
new_with_u8_array_sequence_and_options
new_with_blob_sequence_and_options
new_with_str_sequence_and_options
These multiple methods exist because new Blob
accepts multiple different types, and so web-sys generates one method per type.
However, these multiple methods are completely useless, because they all compile down to new Blob
on the JS side, and they have the same type on the Rust side. This has caused confusion for users.
I see two options:
-
Remove them and just have two methods:
Blob::new_with_array
andBlob::new_with_array_and_options
which accept&Array
-
Keep them but change their type to be more useful. For example,
new_with_u8_array_sequence
could accept a&[u8]
,new_with_blob_sequence
could accept a&Blob
, etc.Because
new Blob
accepts 14 different Rust types, that would mean we would need 28 different methods with this approach.
I personally lean toward option 1.