diff --git a/components/style/gecko_bindings/sugar/ns_style_auto_array.rs b/components/style/gecko_bindings/sugar/ns_style_auto_array.rs index 4b01116f4ea..5730382d7d1 100644 --- a/components/style/gecko_bindings/sugar/ns_style_auto_array.rs +++ b/components/style/gecko_bindings/sugar/ns_style_auto_array.rs @@ -2,21 +2,27 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +//! Rust helpers for Gecko's `nsStyleAutoArray`. + use gecko_bindings::structs::nsStyleAutoArray; use std::iter::{once, Chain, Once, IntoIterator}; use std::slice::{Iter, IterMut}; impl nsStyleAutoArray { + /// Mutably iterate over the array elements. pub fn iter_mut(&mut self) -> Chain, IterMut> { once(&mut self.mFirstElement).chain(self.mOtherElements.iter_mut()) } + + /// Iterate over the array elements. pub fn iter(&self) -> Chain, Iter> { 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 - // in sync + /// Returns the length of the array. + /// + /// Note that often structs containing autoarrays will have additional + /// member fields that contain the length, which must be kept in sync. pub fn len(&self) -> usize { 1 + self.mOtherElements.len() }