it: test subsurface positioning
This commit is contained in:
parent
fd027d9a5a
commit
cbf539cbcc
17 changed files with 291 additions and 9 deletions
17
src/it/test_utils/test_object_ext.rs
Normal file
17
src/it/test_utils/test_object_ext.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use {
|
||||
crate::{it::test_error::TestError, object::Object},
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
||||
pub trait TestObjectExt {
|
||||
fn downcast<T: 'static>(self: Rc<Self>) -> Result<Rc<T>, TestError>;
|
||||
}
|
||||
|
||||
impl TestObjectExt for dyn Object {
|
||||
fn downcast<T: 'static>(self: Rc<Self>) -> Result<Rc<T>, TestError> {
|
||||
match self.into_any().downcast() {
|
||||
Ok(t) => Ok(t),
|
||||
_ => bail!("Object has an incompatible type id"),
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue