Struct wayland_client::Main
source · [−]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
sourceimpl<I: Interface> Main<I> where
I: AsRef<Proxy<I>> + From<Proxy<I>>,
impl<I: Interface> Main<I> where
I: AsRef<Proxy<I>> + From<Proxy<I>>,
sourcepub fn assign<E>(&self, filter: Filter<E>) where
I: Sync,
E: From<(Main<I>, I::Event)> + 'static,
I::Event: MessageGroup<Map = ProxyMap>,
pub fn assign<E>(&self, filter: Filter<E>) where
I: Sync,
E: From<(Main<I>, I::Event)> + 'static,
I::Event: MessageGroup<Map = ProxyMap>,
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) where
I: Interface + AsRef<Proxy<I>> + From<Proxy<I>> + Sync,
F: FnMut(Main<I>, I::Event, DispatchData<'_>) + 'static,
I::Event: MessageGroup<Map = ProxyMap>,
pub fn quick_assign<F>(&self, f: F) where
I: Interface + AsRef<Proxy<I>> + From<Proxy<I>> + Sync,
F: FnMut(Main<I>, I::Event, DispatchData<'_>) + 'static,
I::Event: MessageGroup<Map = ProxyMap>,
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)
.
sourceimpl Main<AnonymousObject>
impl Main<AnonymousObject>
sourceimpl<I: Interface> Main<I> where
I: AsRef<Proxy<I>> + From<Proxy<I>>,
impl<I: Interface> Main<I> where
I: AsRef<Proxy<I>> + From<Proxy<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
Methods from Deref<Target = Attached<I>>
Trait Implementations
sourceimpl<I: PartialEq + Interface + AsRef<Proxy<I>> + From<Proxy<I>>> PartialEq<Main<I>> for Main<I>
impl<I: PartialEq + Interface + AsRef<Proxy<I>> + From<Proxy<I>>> PartialEq<Main<I>> for Main<I>
impl<I: Interface + AsRef<Proxy<I>> + From<Proxy<I>>> StructuralPartialEq for Main<I>
Auto Trait Implementations
impl<I> RefUnwindSafe for Main<I> where
I: RefUnwindSafe,
impl<I> !Send for Main<I>
impl<I> !Sync for Main<I>
impl<I> Unpin for Main<I> where
I: Unpin,
impl<I> UnwindSafe for Main<I> where
I: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more