|
@@ -1,4 +1,4 @@
|
|
-use std::{collections::HashMap, fmt::Debug};
|
|
|
|
|
|
+use std::{any::Any, collections::HashMap, fmt::Debug};
|
|
|
|
|
|
use dioxus_core::Event;
|
|
use dioxus_core::Event;
|
|
|
|
|
|
@@ -45,6 +45,12 @@ impl FileEngine for SerializedFileEngine {
|
|
.await
|
|
.await
|
|
.map(|bytes| String::from_utf8_lossy(&bytes).to_string())
|
|
.map(|bytes| String::from_utf8_lossy(&bytes).to_string())
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ async fn get_native_file(&self, file: &str) -> Option<Box<dyn Any>> {
|
|
|
|
+ self.read_file(file)
|
|
|
|
+ .await
|
|
|
|
+ .map(|val| Box::new(val) as Box<dyn Any>)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
#[cfg(feature = "serialize")]
|
|
#[cfg(feature = "serialize")]
|
|
@@ -89,6 +95,9 @@ pub trait FileEngine {
|
|
|
|
|
|
// read a file to string
|
|
// read a file to string
|
|
async fn read_file_to_string(&self, file: &str) -> Option<String>;
|
|
async fn read_file_to_string(&self, file: &str) -> Option<String>;
|
|
|
|
+
|
|
|
|
+ // returns a file in platform's native representation
|
|
|
|
+ async fn get_native_file(&self, file: &str) -> Option<Box<dyn Any>>;
|
|
}
|
|
}
|
|
|
|
|
|
impl_event! {
|
|
impl_event! {
|