Skip to content

Commit

Permalink
Implement nsStyleAutoArray.ensure_len(). r=heycam
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroyuki Ikezoe authored and Hiroyuki Ikezoe committed Jan 10, 2017
1 parent dc3b480 commit 98ed440
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/style/gecko_bindings/sugar/ns_style_auto_array.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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> {
Expand Down

0 comments on commit 98ed440

Please sign in to comment.