mirror of
https://github.com/servo/servo.git
synced 2025-08-30 09:38:19 +01:00
Declare nullable strong borrowed ref type for RawServoDeclarationBlock.
This commit is contained in:
parent
edeeafe5a7
commit
f967647226
3 changed files with 17 additions and 0 deletions
|
@ -161,6 +161,20 @@ impl<T> Strong<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
/// Given a reference to a strong FFI reference,
|
||||
/// converts it to a reference to a servo-side Arc
|
||||
/// Returns None on null.
|
||||
///
|
||||
/// Strong<GeckoType> -> Arc<ServoType>
|
||||
pub fn as_arc_opt<U>(&self) -> Option<&Arc<U>> where U: HasArcFFI<FFIType = T> {
|
||||
if self.is_null() {
|
||||
None
|
||||
} else {
|
||||
unsafe { Some(transmute(self)) }
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
/// Produces a null strong FFI reference
|
||||
pub fn null() -> Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue