mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-10 06:34:20 +00:00
Change file-engine to be file_engine for consistency
This commit is contained in:
parent
459dbde697
commit
fd9229a768
8 changed files with 24 additions and 24 deletions
|
@ -67,7 +67,7 @@ tokio = { workspace = true, features = ["time"] }
|
|||
manganis = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = ["serialize", "mounted", "document", "file-engine"]
|
||||
default = ["serialize", "mounted", "document", "file_engine"]
|
||||
serialize = [
|
||||
"dep:serde",
|
||||
"dep:serde_json",
|
||||
|
@ -88,7 +88,7 @@ document = [
|
|||
"dep:serde",
|
||||
"dep:serde_json"
|
||||
]
|
||||
file-engine = [
|
||||
file_engine = [
|
||||
"dep:async-trait",
|
||||
"dep:js-sys",
|
||||
"web-sys?/File",
|
||||
|
@ -96,7 +96,7 @@ file-engine = [
|
|||
"web-sys?/FileReader"
|
||||
]
|
||||
wasm-bind = ["dep:web-sys", "dep:wasm-bindgen", "dep:wasm-bindgen-futures"]
|
||||
native-bind = ["dep:tokio", "file-engine"]
|
||||
native-bind = ["dep:tokio", "file_engine"]
|
||||
hot-reload-context = ["dep:dioxus-rsx"]
|
||||
html-to-rsx = []
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ impl DragData {
|
|||
}
|
||||
|
||||
impl crate::HasFileData for DragData {
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
fn files(&self) -> Option<std::sync::Arc<dyn crate::file_data::FileEngine>> {
|
||||
self.inner.files()
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ impl PointerInteraction for DragData {
|
|||
pub struct SerializedDragData {
|
||||
pub mouse: crate::point_interaction::SerializedPointInteraction,
|
||||
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
#[serde(default)]
|
||||
files: Option<crate::file_data::SerializedFileEngine>,
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ impl SerializedDragData {
|
|||
fn new(drag: &DragData) -> Self {
|
||||
Self {
|
||||
mouse: crate::point_interaction::SerializedPointInteraction::from(drag),
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
files: None,
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ impl HasDragData for SerializedDragData {
|
|||
|
||||
#[cfg(feature = "serialize")]
|
||||
impl crate::file_data::HasFileData for SerializedDragData {
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
fn files(&self) -> Option<std::sync::Arc<dyn crate::file_data::FileEngine>> {
|
||||
self.files
|
||||
.as_ref()
|
||||
|
|
|
@ -105,7 +105,7 @@ impl FormData {
|
|||
}
|
||||
|
||||
/// Get the files of the form event
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
pub fn files(&self) -> Option<std::sync::Arc<dyn crate::file_data::FileEngine>> {
|
||||
self.inner.files()
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ pub struct SerializedFormData {
|
|||
#[serde(default)]
|
||||
valid: bool,
|
||||
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
#[serde(default)]
|
||||
files: Option<crate::file_data::SerializedFileEngine>,
|
||||
}
|
||||
|
@ -190,12 +190,12 @@ impl SerializedFormData {
|
|||
value,
|
||||
values,
|
||||
valid: true,
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
files: None,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
/// Add files to the serialized form data object
|
||||
pub fn with_files(mut self, files: crate::file_data::SerializedFileEngine) -> Self {
|
||||
self.files = Some(files);
|
||||
|
@ -208,7 +208,7 @@ impl SerializedFormData {
|
|||
value: data.value(),
|
||||
values: data.values(),
|
||||
valid: data.valid(),
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
files: {
|
||||
match data.files() {
|
||||
Some(files) => {
|
||||
|
@ -234,7 +234,7 @@ impl SerializedFormData {
|
|||
value: data.value(),
|
||||
values: data.values(),
|
||||
valid: data.valid(),
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
files: None,
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ impl HasFormData for SerializedFormData {
|
|||
|
||||
#[cfg(feature = "serialize")]
|
||||
impl HasFileData for SerializedFormData {
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
fn files(&self) -> Option<std::sync::Arc<dyn crate::FileEngine>> {
|
||||
self.files
|
||||
.as_ref()
|
||||
|
@ -269,7 +269,7 @@ impl HasFileData for SerializedFormData {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
impl HasFileData for FormData {
|
||||
fn files(&self) -> Option<std::sync::Arc<dyn crate::FileEngine>> {
|
||||
self.inner.files()
|
||||
|
|
|
@ -2,14 +2,14 @@ pub trait HasFileData: std::any::Any {
|
|||
// NOTE: The methods of this trait are config'ed out instead of the trait
|
||||
// itself because several other traits inherit from this trait and there isn't a clean way to
|
||||
// conditionally inherit from a trait based on a config.
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
fn files(&self) -> Option<std::sync::Arc<dyn FileEngine>> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "serialize")]
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
/// A file engine that serializes files to bytes
|
||||
#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq, Clone)]
|
||||
pub struct SerializedFileEngine {
|
||||
|
@ -17,7 +17,7 @@ pub struct SerializedFileEngine {
|
|||
}
|
||||
|
||||
#[cfg(feature = "serialize")]
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl FileEngine for SerializedFileEngine {
|
||||
fn files(&self) -> Vec<String> {
|
||||
|
@ -46,7 +46,7 @@ impl FileEngine for SerializedFileEngine {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
#[async_trait::async_trait(?Send)]
|
||||
pub trait FileEngine {
|
||||
// get a list of file names
|
||||
|
|
|
@ -16,7 +16,7 @@ impl NativeFileEngine {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl FileEngine for NativeFileEngine {
|
||||
fn files(&self) -> Vec<String> {
|
||||
|
|
|
@ -658,7 +658,7 @@ impl HasMediaData for web_sys::Event {
|
|||
}
|
||||
|
||||
impl HasFileData for web_sys::Event {
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
fn files(&self) -> Option<std::sync::Arc<dyn crate::file_data::FileEngine>> {
|
||||
let files = self
|
||||
.dyn_ref()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
mod events;
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
mod file_engine;
|
||||
#[cfg(feature = "file-engine")]
|
||||
#[cfg(feature = "file_engine")]
|
||||
pub use file_engine::*;
|
||||
|
|
|
@ -64,7 +64,7 @@ panic_hook = ["dep:console_error_panic_hook"]
|
|||
hydrate = ["web-sys/Comment", "ciborium", "dep:serde"]
|
||||
mounted = ["web-sys/Element", "dioxus-html/mounted"]
|
||||
file_engine = [
|
||||
"dioxus-html/file-engine",
|
||||
"dioxus-html/file_engine",
|
||||
]
|
||||
devtools = ["web-sys/MessageEvent", "web-sys/WebSocket", "web-sys/Location", "dep:serde_json", "dep:serde", "dioxus-core/serialize"]
|
||||
document = ["dioxus-html/document", "dep:serde-wasm-bindgen", "dep:serde_json", "dep:serde"]
|
||||
|
|
Loading…
Reference in a new issue