Move the manganis into attribute value implementation into dioxus core (#2765)

This commit is contained in:
Evan Almloff 2024-08-02 00:38:01 +02:00 committed by GitHub
parent e0bb67b476
commit 9dbdf74a1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 1 deletions

1
Cargo.lock generated
View file

@ -2578,6 +2578,7 @@ dependencies = [
"futures-util",
"generational-box",
"longest-increasing-subsequence",
"manganis",
"pretty_assertions",
"rand 0.8.5",
"reqwest 0.12.5",

View file

@ -25,6 +25,7 @@ generational-box = { workspace = true }
rustversion = "1.0.17"
const_format = { workspace = true }
warnings = { workspace = true }
manganis = { workspace = true, default-features = false, optional = true }
[dev-dependencies]
tokio = { workspace = true, features = ["full"] }
@ -47,6 +48,7 @@ features = [
[features]
serialize = ["dep:serde"]
manganis = ["dep:manganis"]
[package.metadata.docs.rs]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]

View file

@ -1096,6 +1096,13 @@ impl<T: IntoAttributeValue> IntoAttributeValue for Option<T> {
}
}
#[cfg(feature = "manganis")]
impl IntoAttributeValue for manganis::ImageAsset {
fn into_value(self) -> AttributeValue {
AttributeValue::Text(self.path().to_string())
}
}
/// A trait for anything that has a dynamic list of attributes
pub trait HasAttributes {
/// Push an attribute onto the list of attributes

View file

@ -43,7 +43,7 @@ hooks = ["dep:dioxus-hooks"]
hot-reload = ["dep:dioxus-hot-reload", "dioxus-web?/hot_reload", "dioxus-fullstack?/hot-reload"]
mounted = ["dioxus-web?/mounted", "dioxus-html?/mounted"]
file_engine = ["dioxus-web?/file_engine"]
asset = ["dep:manganis"]
asset = ["dep:manganis", "dioxus-core/manganis"]
document = ["dioxus-web?/document", "dioxus-html?/document"]
launch = ["dep:dioxus-config-macro"]