Skip to main content

DynResourceExt

Trait DynResourceExt 

Source
trait DynResourceExt {
    // Required methods
    fn expect_downcast_ref<T: DynResource>(&self) -> &T;
    unsafe fn unbox<T: DynResource + 'static>(self: Box<Self>) -> T;
}
Expand description

Extension trait for DynResource used by implementations of various dynamic resource traits.

Required Methods§

Source

fn expect_downcast_ref<T: DynResource>(&self) -> &T

§Panics
  • Panics if self is not downcastable to T.
Source

unsafe fn unbox<T: DynResource + 'static>(self: Box<Self>) -> T

Unboxes a Box<dyn DynResource> to a concrete type.

§Safety
  • self must be the correct concrete type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§