mirror of
https://github.com/servo/servo.git
synced 2025-08-11 00:15:32 +01:00
style: Introduce ArcSlice, a small wrapper over ThinArc but without an explicit header.
We could make the header PhantomData or something, but then we wouldn't be able to bind to C++, since C++ doesn't have ZSTs. So add a canary instead to add a runtime check of stuff being sane. Differential Revision: https://phabricator.services.mozilla.com/D30133
This commit is contained in:
parent
2ed2151b3d
commit
0d5c4481b8
6 changed files with 98 additions and 3 deletions
|
@ -462,3 +462,17 @@ where
|
|||
Ok(v.into_boxed_slice())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> ToAnimatedZero for crate::ArcSlice<T>
|
||||
where
|
||||
T: ToAnimatedZero,
|
||||
{
|
||||
#[inline]
|
||||
fn to_animated_zero(&self) -> Result<Self, ()> {
|
||||
let v = self
|
||||
.iter()
|
||||
.map(|v| v.to_animated_zero())
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
Ok(crate::ArcSlice::from_iter(v.into_iter()))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue