Introduce LayoutDom::is

Just like Castable::is.
This commit is contained in:
Anthony Ramine 2020-03-31 22:06:26 +02:00
parent 9c8540af5c
commit f014da9565
4 changed files with 14 additions and 6 deletions

View file

@ -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>