use CapturedError as dioxus::Ok() so resources still function as expected (#4851)
This commit is contained in:
1 parent
9f0bacc85c
commit
281f68faf5
14 files changed
+200
-54
No files matched your search
@@ -39,7 +39,7 @@ impl NativeFileData for WebFileData {
|
||||
|
||||
fn read_bytes(
|
||||
&self,
|
||||
) -> Pin<Box<dyn Future<Output = Result<Bytes, dioxus_core::Error>> + 'static>> {
|
||||
) -> Pin<Box<dyn Future<Output = Result<Bytes, dioxus_core::CapturedError>> + 'static>> {
|
||||
let file_reader = self.reader.clone();
|
||||
let file_reader_ = self.reader.clone();
|
||||
let file = self.file.clone();
|
||||
@@ -72,7 +72,7 @@ impl NativeFileData for WebFileData {
|
||||
|
||||
fn read_string(
|
||||
&self,
|
||||
) -> Pin<Box<dyn Future<Output = Result<String, dioxus_core::Error>> + 'static>> {
|
||||
) -> Pin<Box<dyn Future<Output = Result<String, dioxus_core::CapturedError>> + 'static>> {
|
||||
let file_reader = self.reader.clone();
|
||||
let file_reader_ = self.reader.clone();
|
||||
let file = self.file.clone();
|
||||
@@ -113,8 +113,13 @@ impl NativeFileData for WebFileData {
|
||||
/// We should maybe update these APIs to use our own custom `ByteBuffer` type to avoid going through `Vec<u8>`?
|
||||
fn byte_stream(
|
||||
&self,
|
||||
) -> Pin<Box<dyn futures_util::Stream<Item = Result<Bytes, dioxus_core::Error>> + 'static + Send>>
|
||||
{
|
||||
) -> Pin<
|
||||
Box<
|
||||
dyn futures_util::Stream<Item = Result<Bytes, dioxus_core::CapturedError>>
|
||||
+ 'static
|
||||
+ Send,
|
||||
>,
|
||||
> {
|
||||
let file = self.file.dyn_ref::<web_sys::Blob>().unwrap().clone();
|
||||
Box::pin(SendWrapper::new(futures_util::stream::once(async move {
|
||||
let array_buff = wasm_bindgen_futures::JsFuture::from(file.array_buffer())
|
||||
|
||||
Reference in new issue
Block a user