Struct wayland_client::Main
source · pub struct Main<I: Interface + AsRef<Proxy<I>> + From<Proxy<I>>> { /* private fields */ }
Expand description
A main handle to a proxy
This handle allows the same control as an Attached
handle,
but additionnaly can be used to assign the proxy to a Filter
,
in order to process its events.
Implementations§
source§impl<I> Main<I>
impl<I> Main<I>
sourcepub fn assign<E>(&self, filter: Filter<E>)
pub fn assign<E>(&self, filter: Filter<E>)
Assign this object to given filter
All future event received by this object will be delivered to this filter.
An object that is not assigned to any filter will see its events delivered to the fallback callback of its event queue.
Event message type of the filter should verify
E: From<(Main<I>, I::Event)>
. See the event_enum!
macro provided
in this library to easily generate appropriate types.
sourcepub fn quick_assign<F>(&self, f: F)
pub fn quick_assign<F>(&self, f: F)
Shorthand for assigning a closure to an object
Behaves similarly as assign(..)
, but is a shorthand if
you want to assign this object to its own filter. In which
case you just need to provide the appropriate closure, of
type FnMut(Main<I>, I::Event)
.
source§impl Main<AnonymousObject>
impl Main<AnonymousObject>
source§impl<I> Main<I>
impl<I> Main<I>
sourcepub unsafe fn from_c_ptr(_ptr: *mut wl_proxy) -> Main<I>
pub unsafe fn from_c_ptr(_ptr: *mut wl_proxy) -> Main<I>
Create a Main
instance from a C pointer
Create a Main
from a raw pointer to a wayland object from the
C library.
In order to handle protocol races, invoking it with a NULL pointer will create an already-dead object.
NOTE: This method will panic if called while the use_system_lib
feature is
not activated.
Safety
This will take control of the underlying proxy & manage it. To be safe you must ensure that:
- The provided proxy has not already been used in any way (it was just created)
- This is called from the same thread as the one hosting the event queue handling this proxy