mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
Inconsistent clone() requirement when passing Classes to HTML elements vs. components (#3589) (#3931)
* Add From<&Classes> impl to allow &Classes in element props (#3589) * bless macro test error output adds an additional candidate to the impl block, which is fine --------- Co-authored-by: Martin Molzer <WorldSEnder@users.noreply.github.com>
This commit is contained in:
parent
0c986740ac
commit
38e7f2bcf4
@ -17,6 +17,7 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
|
||||
| ^^ the trait `From<{integer}>` is not implemented for `Classes`
|
||||
|
|
||||
= help: the following other types implement trait `From<T>`:
|
||||
`Classes` implements `From<&Classes>`
|
||||
`Classes` implements `From<&Option<T>>`
|
||||
`Classes` implements `From<&String>`
|
||||
`Classes` implements `From<&[T]>`
|
||||
@ -24,7 +25,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
|
||||
`Classes` implements `From<&str>`
|
||||
`Classes` implements `From<Cow<'_, str>>`
|
||||
`Classes` implements `From<Option<T>>`
|
||||
`Classes` implements `From<String>`
|
||||
and $N others
|
||||
= note: required for `{integer}` to implement `Into<Classes>`
|
||||
note: required by a bound in `Classes::push`
|
||||
@ -40,6 +40,7 @@ error[E0277]: the trait bound `Classes: From<{float}>` is not satisfied
|
||||
| ^^^^ the trait `From<{float}>` is not implemented for `Classes`
|
||||
|
|
||||
= help: the following other types implement trait `From<T>`:
|
||||
`Classes` implements `From<&Classes>`
|
||||
`Classes` implements `From<&Option<T>>`
|
||||
`Classes` implements `From<&String>`
|
||||
`Classes` implements `From<&[T]>`
|
||||
@ -47,7 +48,6 @@ error[E0277]: the trait bound `Classes: From<{float}>` is not satisfied
|
||||
`Classes` implements `From<&str>`
|
||||
`Classes` implements `From<Cow<'_, str>>`
|
||||
`Classes` implements `From<Option<T>>`
|
||||
`Classes` implements `From<String>`
|
||||
and $N others
|
||||
= note: required for `{float}` to implement `Into<Classes>`
|
||||
note: required by a bound in `Classes::push`
|
||||
@ -66,6 +66,7 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the following other types implement trait `From<T>`:
|
||||
`Classes` implements `From<&Classes>`
|
||||
`Classes` implements `From<&Option<T>>`
|
||||
`Classes` implements `From<&String>`
|
||||
`Classes` implements `From<&[T]>`
|
||||
@ -73,7 +74,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
|
||||
`Classes` implements `From<&str>`
|
||||
`Classes` implements `From<Cow<'_, str>>`
|
||||
`Classes` implements `From<Option<T>>`
|
||||
`Classes` implements `From<String>`
|
||||
and $N others
|
||||
= note: required for `{integer}` to implement `Into<Classes>`
|
||||
= note: required for `Classes` to implement `From<Vec<{integer}>>`
|
||||
@ -92,6 +92,7 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
|
||||
| ^^^^ the trait `From<{integer}>` is not implemented for `Classes`
|
||||
|
|
||||
= help: the following other types implement trait `From<T>`:
|
||||
`Classes` implements `From<&Classes>`
|
||||
`Classes` implements `From<&Option<T>>`
|
||||
`Classes` implements `From<&String>`
|
||||
`Classes` implements `From<&[T]>`
|
||||
@ -99,7 +100,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
|
||||
`Classes` implements `From<&str>`
|
||||
`Classes` implements `From<Cow<'_, str>>`
|
||||
`Classes` implements `From<Option<T>>`
|
||||
`Classes` implements `From<String>`
|
||||
and $N others
|
||||
= note: required for `{integer}` to implement `Into<Classes>`
|
||||
= note: required for `Classes` to implement `From<Option<{integer}>>`
|
||||
@ -118,6 +118,7 @@ error[E0277]: the trait bound `Classes: From<u32>` is not satisfied
|
||||
| ^^^^ the trait `From<u32>` is not implemented for `Classes`
|
||||
|
|
||||
= help: the following other types implement trait `From<T>`:
|
||||
`Classes` implements `From<&Classes>`
|
||||
`Classes` implements `From<&Option<T>>`
|
||||
`Classes` implements `From<&String>`
|
||||
`Classes` implements `From<&[T]>`
|
||||
@ -125,7 +126,6 @@ error[E0277]: the trait bound `Classes: From<u32>` is not satisfied
|
||||
`Classes` implements `From<&str>`
|
||||
`Classes` implements `From<Cow<'_, str>>`
|
||||
`Classes` implements `From<Option<T>>`
|
||||
`Classes` implements `From<String>`
|
||||
and $N others
|
||||
= note: required for `u32` to implement `Into<Classes>`
|
||||
= note: required for `Classes` to implement `From<Option<u32>>`
|
||||
@ -144,6 +144,7 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
|
||||
| ^^ the trait `From<{integer}>` is not implemented for `Classes`
|
||||
|
|
||||
= help: the following other types implement trait `From<T>`:
|
||||
`Classes` implements `From<&Classes>`
|
||||
`Classes` implements `From<&Option<T>>`
|
||||
`Classes` implements `From<&String>`
|
||||
`Classes` implements `From<&[T]>`
|
||||
@ -151,7 +152,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
|
||||
`Classes` implements `From<&str>`
|
||||
`Classes` implements `From<Cow<'_, str>>`
|
||||
`Classes` implements `From<Option<T>>`
|
||||
`Classes` implements `From<String>`
|
||||
and $N others
|
||||
= note: required for `{integer}` to implement `Into<Classes>`
|
||||
note: required by a bound in `Classes::push`
|
||||
|
||||
@ -695,6 +695,7 @@ error[E0277]: the trait bound `implicit_clone::unsync::string::IString: From<{in
|
||||
| ^^ the trait `From<{integer}>` is not implemented for `implicit_clone::unsync::string::IString`
|
||||
|
|
||||
= help: the following other types implement trait `From<T>`:
|
||||
`implicit_clone::unsync::string::IString` implements `From<&Classes>`
|
||||
`implicit_clone::unsync::string::IString` implements `From<&implicit_clone::unsync::string::IString>`
|
||||
`implicit_clone::unsync::string::IString` implements `From<&str>`
|
||||
`implicit_clone::unsync::string::IString` implements `From<Arguments<'_>>`
|
||||
|
||||
@ -277,6 +277,18 @@ impl<T: Into<Classes>, const SIZE: usize> From<[T; SIZE]> for Classes {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&Classes> for Classes {
|
||||
fn from(c: &Classes) -> Self {
|
||||
c.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&Classes> for AttrValue {
|
||||
fn from(c: &Classes) -> Self {
|
||||
c.clone().into_prop_value()
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for Classes {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.set.len() == other.set.len() && self.set.iter().eq(other.set.iter())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user