wgpu_hal::dynamic

Trait DynResourceExt

Source
trait DynResourceExt {
    // Required methods
    fn expect_downcast_ref<T: DynResource>(&self) -> &T;
    fn expect_downcast_mut<T: DynResource>(&mut self) -> &mut 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

fn expect_downcast_mut<T: DynResource>(&mut self) -> &mut 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", so this trait is not object safe.

Implementors§