mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Allow vector properties to be set by iterator
This commit is contained in:
parent
dd3159f2f5
commit
33fb27c765
4 changed files with 174 additions and 78 deletions
|
@ -101,6 +101,7 @@ impl<'a> Context<'a> {
|
|||
}
|
||||
|
||||
/// An iterator over a slice of computed values
|
||||
#[derive(Clone)]
|
||||
pub struct ComputedVecIter<'a, 'cx, 'cx_a: 'cx, S: ToComputedValue + 'a> {
|
||||
cx: &'cx Context<'cx_a>,
|
||||
values: &'a [S],
|
||||
|
@ -116,6 +117,12 @@ impl<'a, 'cx, 'cx_a: 'cx, S: ToComputedValue + 'a> ComputedVecIter<'a, 'cx, 'cx_
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'cx, 'cx_a: 'cx, S: ToComputedValue + 'a> ExactSizeIterator for ComputedVecIter<'a, 'cx, 'cx_a, S> {
|
||||
fn len(&self) -> usize {
|
||||
self.values.len()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'cx, 'cx_a: 'cx, S: ToComputedValue + 'a> Iterator for ComputedVecIter<'a, 'cx, 'cx_a, S> {
|
||||
type Item = S::ComputedValue;
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue