mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
style: Improve handling of copying arrays in layout/style/ and servo/.
Differential Revision: https://phabricator.services.mozilla.com/D72351
This commit is contained in:
parent
735fdedbe9
commit
e6687c5fa8
1 changed files with 14 additions and 1 deletions
|
@ -5,7 +5,7 @@
|
|||
//! Rust helpers for Gecko's nsTArray.
|
||||
|
||||
use crate::gecko_bindings::bindings;
|
||||
use crate::gecko_bindings::structs::{nsTArray, nsTArrayHeader};
|
||||
use crate::gecko_bindings::structs::{nsTArray, nsTArrayHeader, CopyableTArray};
|
||||
use std::mem;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::slice;
|
||||
|
@ -128,3 +128,16 @@ impl<T> nsTArray<T> {
|
|||
self.iter_mut().zip(iter).for_each(|(r, v)| *r = v);
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Deref for CopyableTArray<T> {
|
||||
type Target = nsTArray<T>;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self._base
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> DerefMut for CopyableTArray<T> {
|
||||
fn deref_mut(&mut self) -> &mut nsTArray<T> {
|
||||
&mut self._base
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue