mirror of
https://github.com/casey/just.git
synced 2024-11-22 02:09:44 +03:00
Implement FromIterator for AttributeSet
This commit is contained in:
parent
c78467a171
commit
90537ca002
@ -148,11 +148,13 @@ impl<'src, 'a> IntoIterator for &'a AttributeSet<'src> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'src> AttributeSet<'src> {
|
||||
pub(crate) fn from_iter(iter: impl IntoIterator<Item = Attribute<'src>>) -> Self {
|
||||
impl<'src, 'a> FromIterator<Attribute<'src>> for AttributeSet<'src> {
|
||||
fn from_iter<T: IntoIterator<Item = attribute::Attribute<'src>>>(iter: T) -> Self {
|
||||
Self(iter.into_iter().collect())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'src> AttributeSet<'src> {
|
||||
pub(crate) fn len(&self) -> usize {
|
||||
self.0.len()
|
||||
}
|
||||
|
@ -1152,8 +1152,7 @@ impl<'run, 'src> Parser<'run, 'src> {
|
||||
if attributes.is_empty() {
|
||||
Ok(None)
|
||||
} else {
|
||||
let attribute_set = AttributeSet::from_iter(attributes.into_keys());
|
||||
Ok(Some((token.unwrap(), attribute_set)))
|
||||
Ok(Some((token.unwrap(), attributes.into_keys().collect())))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user