mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Implement nsStyleAutoArray.ensure_len(). r=heycam
This commit is contained in:
parent
dc3b4803d1
commit
98ed440597
1 changed files with 9 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
//! Rust helpers for Gecko's `nsStyleAutoArray`.
|
//! Rust helpers for Gecko's `nsStyleAutoArray`.
|
||||||
|
|
||||||
|
use gecko_bindings::bindings::Gecko_EnsureStyleAnimationArrayLength;
|
||||||
use gecko_bindings::structs::nsStyleAutoArray;
|
use gecko_bindings::structs::nsStyleAutoArray;
|
||||||
use std::iter::{once, Chain, Once, IntoIterator};
|
use std::iter::{once, Chain, Once, IntoIterator};
|
||||||
use std::ops::Index;
|
use std::ops::Index;
|
||||||
|
@ -40,6 +41,14 @@ impl<T> nsStyleAutoArray<T> {
|
||||||
pub fn len(&self) -> usize {
|
pub fn len(&self) -> usize {
|
||||||
1 + self.mOtherElements.len()
|
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> {
|
impl<'a, T> IntoIterator for &'a mut nsStyleAutoArray<T> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue