mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
style: Use OwnedSlice in the specified and computed values of most vector properties.
This is just a refactor in the right direction. Eventual goal is: * All inherited properties use ArcSlice<>. * All reset properties use OwnedSlice<> (or ThinVec<>). No conversion happens at all, so we can remove all that glue, and also compute_iter and co. Of course there's work to do, but this is a step towards that. Differential Revision: https://phabricator.services.mozilla.com/D30127
This commit is contained in:
parent
b61eb84d96
commit
ab8776a144
9 changed files with 100 additions and 107 deletions
|
@ -10,7 +10,7 @@ use malloc_size_of::{MallocShallowSizeOf, MallocSizeOf, MallocSizeOfOps};
|
|||
use std::marker::PhantomData;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::ptr::NonNull;
|
||||
use std::{fmt, mem, slice};
|
||||
use std::{fmt, iter, mem, slice};
|
||||
use to_shmem::{SharedMemoryBuilder, ToShmem};
|
||||
|
||||
/// A struct that basically replaces a `Box<[T]>`, but which cbindgen can
|
||||
|
@ -164,3 +164,10 @@ impl<T: ToShmem + Sized> ToShmem for OwnedSlice<T> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> iter::FromIterator<T> for OwnedSlice<T> {
|
||||
#[inline]
|
||||
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self {
|
||||
Vec::from_iter(iter).into()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue