Make most background- properties handle arrays

This commit is contained in:
Manish Goregaokar 2016-08-19 17:09:41 +05:30
parent ce9640a48e
commit 65a8a8dccb
4 changed files with 72 additions and 67 deletions

View file

@ -3,13 +3,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::iter::{once, Chain, Once, IntoIterator};
use std::slice::IterMut;
use std::slice::{Iter, IterMut};
use structs::nsStyleAutoArray;
impl<T> nsStyleAutoArray<T> {
pub fn iter_mut(&mut self) -> Chain<Once<&mut T>, IterMut<T>> {
once(&mut self.mFirstElement).chain(self.mOtherElements.iter_mut())
}
pub fn iter(&self) -> Chain<Once<&T>, Iter<T>> {
once(&self.mFirstElement).chain(self.mOtherElements.iter())
}
// Note that often structs containing autoarrays will have
// additional member fields that contain the length, which must be kept