Implement nsStyleAutoArray.ensure_len(). r=heycam

This commit is contained in:
Hiroyuki Ikezoe 2017-01-06 19:55:31 +09:00 committed by Hiroyuki Ikezoe
parent dc3b4803d1
commit 98ed440597

View file

@ -4,6 +4,7 @@
//! Rust helpers for Gecko's `nsStyleAutoArray`.
use gecko_bindings::bindings::Gecko_EnsureStyleAnimationArrayLength;
use gecko_bindings::structs::nsStyleAutoArray;
use std::iter::{once, Chain, Once, IntoIterator};
use std::ops::Index;
@ -40,6 +41,14 @@ impl<T> nsStyleAutoArray<T> {
pub fn len(&self) -> usize {
1 + self.mOtherElements.len()
}
/// Ensures that the array has length at least the given length.
pub fn ensure_len(&mut self, len: usize) {
unsafe {
Gecko_EnsureStyleAnimationArrayLength(self as *mut nsStyleAutoArray<T> as *mut _,
len);
}
}
}
impl<'a, T> IntoIterator for &'a mut nsStyleAutoArray<T> {