[go: up one dir, main page]

Event

Trait Event 

Source
pub trait Event: Debug + Downcast {
    // Required method
    fn pass(
        self: Box<Self>,
        _ctx: &mut Context,
        children: &Vec<((f32, f32), (f32, f32))>,
    ) -> Vec<Option<Box<dyn Event>>>;
}
Expand description

Implement the Event trait to allow a structure to be used in an event query.

Required Methods§

Source

fn pass( self: Box<Self>, _ctx: &mut Context, children: &Vec<((f32, f32), (f32, f32))>, ) -> Vec<Option<Box<dyn Event>>>

Optionally return a clone to continue passing the event to children, or None to stop propagation. Can also modify the event before passing it on.

Implementations§

Source§

impl dyn Event

Source

pub fn is<__T: Event>(&self) -> bool

Returns true if the trait object wraps an object of type __T.

Source

pub fn downcast<__T: Event>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn’t.

Source

pub fn downcast_rc<__T: Event>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn’t.

Source

pub fn downcast_ref<__T: Event>(&self) -> Option<&__T>

Returns a reference to the object within the trait object if it is of type __T, or None if it isn’t.

Source

pub fn downcast_mut<__T: Event>(&mut self) -> Option<&mut __T>

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn’t.

Implementors§