Struct wayland_server::EventLoopHandle
[−]
[src]
pub struct EventLoopHandle { /* fields omitted */ }
Handle to an event loop
This handle gives you access to methods on an event loop that are safe to do from within a callback.
They are also available on an EventLoop
object via Deref
.
Methods
impl EventLoopHandle
[src]
fn register<R, H>(&mut self, resource: &R, handler_id: usize) -> RegisterStatus where
R: Resource,
H: Handler<R> + Any + Send + 'static,
[src]
R: Resource,
H: Handler<R> + Any + Send + 'static,
Register a resource to a handler of this event loop.
The H type must be provided and match the type of the targetted Handler, or it will panic.
This overwrites any precedently set Handler for this resource and removes its destructor if any.
Returns an error and does nothing if this resource is dead or already managed by something else than this library.
fn register_with_destructor<R, H, D>(
&mut self,
resource: &R,
handler_id: usize
) -> RegisterStatus where
R: Resource,
H: Handler<R> + Any + Send + 'static,
D: Destroy<R> + 'static,
[src]
&mut self,
resource: &R,
handler_id: usize
) -> RegisterStatus where
R: Resource,
H: Handler<R> + Any + Send + 'static,
D: Destroy<R> + 'static,
Register a resource to a handler of this event loop with a destructor
The H type must be provided and match the type of the targetted Handler, or it will panic.
The D type is the one whose Destroy<R>
impl will be used as destructor.
This overwrites any precedently set Handler and destructor for this resource.
Returns an error and does nothing if this resource is dead or already managed by something else than this library.
fn add_handler<H: Any + Send + 'static>(&mut self, handler: H) -> usize
[src]
Insert a new handler to this EventLoop
Returns the index of this handler in the internal array, needed register proxies to it.
fn add_handler_with_init<H: Init + Any + Send + 'static>(
&mut self,
handler: H
) -> usize
[src]
&mut self,
handler: H
) -> usize
Insert a new handler with init
Allows you to insert handlers that require some interaction with the event loop in their initialization, like registering some objects to it.
The handler must implement the Init
trait, and its init method will
be called after its insertion.
fn stop_loop(&mut self)
[src]
Stop looping
If the event loop this handle belongs to is currently running its run()
method, it'll stop and return as soon as the current dispatching session ends.
unsafe fn remove_handler<H: Any + Send + 'static>(&mut self, idx: usize) -> H
[src]
Remove a handler previously inserted in this event loop and returns it.
Panics if the requested type does not match the type of the stored handler or if the specified index was already removed.
Unsafety This function is unsafe because removing a handler while some wayland objects or event sources are still registered to it can lead to access to freed memory. Also, the index of this handler will be reused at next handler insertion.