Change file-engine to be file_engine for consistency

This commit is contained in:
Jonathan Kelley 2024-09-17 17:49:06 -07:00
parent 459dbde697
commit fd9229a768
No known key found for this signature in database
GPG key ID: 1FBB50F7EB0A08BE
8 changed files with 24 additions and 24 deletions

View file

@ -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 = []

View file

@ -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()

View file

@ -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()

View file

@ -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

View file

@ -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> {

View file

@ -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()

View file

@ -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::*;

View file

@ -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"]