mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Add casts to Temporary types
This commit is contained in:
parent
07520de970
commit
fc31aef8b4
1 changed files with 10 additions and 0 deletions
|
@ -5408,6 +5408,16 @@ impl ${name}Cast {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn to_temporary<T: ${toBound}+Reflectable>(base: Temporary<T>) -> Option<Temporary<${name}>> {
|
||||
let base = base.root();
|
||||
let base = base.r();
|
||||
match base.${checkFn}() {
|
||||
true => Some(Temporary::from_rooted(unsafe { base.transmute() })),
|
||||
false => None
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn from_ref<'a, T: ${fromBound}+Reflectable>(derived: JSRef<'a, T>) -> JSRef<'a, ${name}> {
|
||||
unsafe { derived.transmute() }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue