mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
Add impl IntoIterator on &Classes (#3038)
This commit is contained in:
parent
9cd33e1dec
commit
d14fcd2e2d
@ -157,6 +157,16 @@ impl IntoIterator for Classes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl IntoIterator for &Classes {
|
||||||
|
type IntoIter = indexmap::set::IntoIter<AttrValue>;
|
||||||
|
type Item = AttrValue;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn into_iter(self) -> Self::IntoIter {
|
||||||
|
(*self.set).clone().into_iter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ToString for Classes {
|
impl ToString for Classes {
|
||||||
fn to_string(&self) -> String {
|
fn to_string(&self) -> String {
|
||||||
let mut iter = self.set.iter().cloned();
|
let mut iter = self.set.iter().cloned();
|
||||||
@ -347,6 +357,7 @@ mod tests {
|
|||||||
other.push("foo");
|
other.push("foo");
|
||||||
other.push("bar");
|
other.push("bar");
|
||||||
let mut subject = Classes::new();
|
let mut subject = Classes::new();
|
||||||
|
subject.extend(&other);
|
||||||
subject.extend(other);
|
subject.extend(other);
|
||||||
assert!(subject.contains("foo"));
|
assert!(subject.contains("foo"));
|
||||||
assert!(subject.contains("bar"));
|
assert!(subject.contains("bar"));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user