mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Introduce LayoutDom::is
Just like Castable::is.
This commit is contained in:
parent
9c8540af5c
commit
f014da9565
4 changed files with 14 additions and 6 deletions
|
@ -441,6 +441,15 @@ where
|
|||
debug_assert!(thread_state::get().is_layout());
|
||||
self.value.downcast::<U>().map(|value| LayoutDom { value })
|
||||
}
|
||||
|
||||
/// Returns whether this inner object is a U.
|
||||
pub fn is<U>(&self) -> bool
|
||||
where
|
||||
U: DerivedFrom<T>,
|
||||
{
|
||||
debug_assert!(thread_state::get().is_layout());
|
||||
self.value.is::<U>()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> LayoutDom<'_, T>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue