mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
style: Fix servo build, and appease tidy / fmt.
This commit is contained in:
parent
8c004c0858
commit
49842f5031
23 changed files with 165 additions and 53 deletions
|
@ -10,13 +10,14 @@ name = "to_shmem"
|
|||
path = "lib.rs"
|
||||
|
||||
[features]
|
||||
servo = ["serde", "cssparser/serde"]
|
||||
servo = ["serde", "cssparser/serde", "string_cache"]
|
||||
gecko = []
|
||||
|
||||
[dependencies]
|
||||
cssparser = "0.25"
|
||||
serde = {version = "1.0", optional = true}
|
||||
serde = { version = "1.0", optional = true }
|
||||
servo_arc = { path = "../servo_arc" }
|
||||
smallbitvec = "2.1.1"
|
||||
smallvec = "0.6.6"
|
||||
string_cache = { version = "0.7", optional = true }
|
||||
thin-slice = "0.1.0"
|
||||
|
|
|
@ -16,6 +16,8 @@ extern crate cssparser;
|
|||
extern crate servo_arc;
|
||||
extern crate smallbitvec;
|
||||
extern crate smallvec;
|
||||
#[cfg(feature = "string_cache")]
|
||||
extern crate string_cache;
|
||||
extern crate thin_slice;
|
||||
|
||||
use servo_arc::{Arc, ThinArc};
|
||||
|
@ -193,16 +195,18 @@ pub trait ToShmem: Sized {
|
|||
|
||||
#[macro_export]
|
||||
macro_rules! impl_trivial_to_shmem {
|
||||
($($ty:ty),*) => {$(
|
||||
impl $crate::ToShmem for $ty {
|
||||
fn to_shmem(
|
||||
&self,
|
||||
_builder: &mut $crate::SharedMemoryBuilder,
|
||||
) -> ::std::mem::ManuallyDrop<Self> {
|
||||
::std::mem::ManuallyDrop::new(*self)
|
||||
($($ty:ty),*) => {
|
||||
$(
|
||||
impl $crate::ToShmem for $ty {
|
||||
fn to_shmem(
|
||||
&self,
|
||||
_builder: &mut $crate::SharedMemoryBuilder,
|
||||
) -> ::std::mem::ManuallyDrop<Self> {
|
||||
::std::mem::ManuallyDrop::new(*self)
|
||||
}
|
||||
}
|
||||
}
|
||||
)*};
|
||||
)*
|
||||
};
|
||||
}
|
||||
|
||||
impl_trivial_to_shmem!(
|
||||
|
@ -522,3 +526,17 @@ impl ToShmem for SmallBitVec {
|
|||
ManuallyDrop::new(unsafe { SmallBitVec::from_storage(storage) })
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "string_cache")]
|
||||
impl<Static: string_cache::StaticAtomSet> ToShmem for string_cache::Atom<Static> {
|
||||
fn to_shmem(&self, _: &mut SharedMemoryBuilder) -> ManuallyDrop<Self> {
|
||||
// NOTE(emilio): In practice, this can be implemented trivially if
|
||||
// string_cache could expose the implementation detail of static atoms
|
||||
// being an index into the static table (and panicking in the
|
||||
// non-static, non-inline cases).
|
||||
unimplemented!(
|
||||
"If servo wants to share stylesheets across processes, \
|
||||
then ToShmem for Atom needs to be implemented"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue