Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xilem_web: Rewrite modifiers (Attributes, Classes and Styles), and cleanup/extend docs #699

Merged
merged 10 commits into from
Oct 23, 2024
27 changes: 27 additions & 0 deletions xilem_core/src/views/one_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,33 @@ where
}
}

impl<T, A, B, C, D, E, F, G, H, I> AsMut<T> for OneOf<A, B, C, D, E, F, G, H, I>
where
A: AsMut<T>,
B: AsMut<T>,
C: AsMut<T>,
D: AsMut<T>,
E: AsMut<T>,
F: AsMut<T>,
G: AsMut<T>,
H: AsMut<T>,
I: AsMut<T>,
{
fn as_mut(&mut self) -> &mut T {
match self {
OneOf::A(e) => <A as AsMut<T>>::as_mut(e),
OneOf::B(e) => <B as AsMut<T>>::as_mut(e),
OneOf::C(e) => <C as AsMut<T>>::as_mut(e),
OneOf::D(e) => <D as AsMut<T>>::as_mut(e),
OneOf::E(e) => <E as AsMut<T>>::as_mut(e),
OneOf::F(e) => <F as AsMut<T>>::as_mut(e),
OneOf::G(e) => <G as AsMut<T>>::as_mut(e),
OneOf::H(e) => <H as AsMut<T>>::as_mut(e),
OneOf::I(e) => <I as AsMut<T>>::as_mut(e),
}
}
}

Comment on lines +87 to +113
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This resulted from some experiments prior to the With trait, but I don't think it hurts to include this as well to xilem_core.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like the existing AsRef implementation, but I've not spent too much time reasoning about it. That being said, this is fine to add this for consistency.

/// A context type which can support [`OneOf9`] and [related views](super::one_of).
///
/// This should be implemented by users of Xilem Core.
Expand Down
3 changes: 1 addition & 2 deletions xilem_web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ features = [
]

[features]
default = ["hydration"]
hydration = []
default = []
# This interns some often used strings, such as element tags ("div" etc.), which slightly improves performance when creating elements at the cost of a bigger wasm binary
intern_strings = ["wasm-bindgen/enable-interning"]
1 change: 0 additions & 1 deletion xilem_web/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ where
&inner.root,
inner.ctx.fragment.clone(),
false,
#[cfg(feature = "hydration")]
false,
);
new_fragment.seq_rebuild(
Expand Down
Loading