mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +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
|
@ -319,6 +319,7 @@ COMPILATION_TARGETS = {
|
||||||
"RawGeckoNode",
|
"RawGeckoNode",
|
||||||
"RawGeckoElement",
|
"RawGeckoElement",
|
||||||
"RawGeckoDocument",
|
"RawGeckoDocument",
|
||||||
|
"RawServoDeclarationBlockStrong",
|
||||||
],
|
],
|
||||||
"whitelist_functions": [
|
"whitelist_functions": [
|
||||||
"Servo_.*",
|
"Servo_.*",
|
||||||
|
|
|
@ -21,6 +21,8 @@ pub type RawGeckoElementBorrowed<'a> = &'a RawGeckoElement;
|
||||||
pub type RawGeckoElementBorrowedOrNull<'a> = Option<&'a RawGeckoElement>;
|
pub type RawGeckoElementBorrowedOrNull<'a> = Option<&'a RawGeckoElement>;
|
||||||
pub type RawGeckoDocumentBorrowed<'a> = &'a RawGeckoDocument;
|
pub type RawGeckoDocumentBorrowed<'a> = &'a RawGeckoDocument;
|
||||||
pub type RawGeckoDocumentBorrowedOrNull<'a> = Option<&'a RawGeckoDocument>;
|
pub type RawGeckoDocumentBorrowedOrNull<'a> = Option<&'a RawGeckoDocument>;
|
||||||
|
pub type RawServoDeclarationBlockStrongBorrowed<'a> = &'a RawServoDeclarationBlockStrong;
|
||||||
|
pub type RawServoDeclarationBlockStrongBorrowedOrNull<'a> = Option<&'a RawServoDeclarationBlockStrong>;
|
||||||
pub type RawServoStyleSetBorrowed<'a> = &'a RawServoStyleSet;
|
pub type RawServoStyleSetBorrowed<'a> = &'a RawServoStyleSet;
|
||||||
pub type RawServoStyleSetBorrowedMut<'a> = &'a mut RawServoStyleSet;
|
pub type RawServoStyleSetBorrowedMut<'a> = &'a mut RawServoStyleSet;
|
||||||
pub type RawServoStyleSetOwned = ::gecko_bindings::sugar::ownership::Owned<RawServoStyleSet>;
|
pub type RawServoStyleSetOwned = ::gecko_bindings::sugar::ownership::Owned<RawServoStyleSet>;
|
||||||
|
|
|
@ -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]
|
#[inline]
|
||||||
/// Produces a null strong FFI reference
|
/// Produces a null strong FFI reference
|
||||||
pub fn null() -> Self {
|
pub fn null() -> Self {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue