[go: up one dir, main page]

Trait glib::object::Downcast

source ·
pub trait Downcast<T> {
    // Required methods
    fn downcast(self) -> Result<T, Self>
       where Self: Sized;
    unsafe fn downcast_unchecked(self) -> T;
}
Expand description

Downcasts support.

Required Methods§

source

fn downcast(self) -> Result<T, Self>
where Self: Sized,

Tries to downcast to T.

Returns Ok(T) if the instance implements T and Err(Self) otherwise.

source

unsafe fn downcast_unchecked(self) -> T

Downcasts to T unconditionally.

Panics if compiled with debug_assertions and the instance doesn’t implement T.

Implementors§

source§

impl<Super: Upcast<Super>, Sub: Upcast<Super>> Downcast<Sub> for Super