[][src]Struct wayland_client::Main

pub struct Main<I: Interface + AsRef<Proxy<I>> + From<Proxy<I>>> { /* fields omitted */ }

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

impl<I: Interface> Main<I> where
    I: AsRef<Proxy<I>> + From<Proxy<I>>, 
[src]

pub fn assign<E>(&self, filter: Filter<E>) where
    I: Sync,
    E: From<(Main<I>, I::Event)> + 'static,
    I::Event: MessageGroup<Map = ProxyMap>, 
[src]

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.

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>, 
[src]

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).

impl Main<AnonymousObject>[src]

pub fn deanonymize<I: Interface + AsRef<Proxy<I>> + From<Proxy<I>>>(
    self
) -> Result<Main<I>, Self>
[src]

Attempt to recover the typed variant of an anonymous proxy

impl<I: Interface> Main<I> where
    I: AsRef<Proxy<I>> + From<Proxy<I>>, 
[src]

pub unsafe fn from_c_ptr(_ptr: *mut wl_proxy) -> Main<I>[src]

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>>

pub fn detach(&self) -> I[src]

Create a non-attached handle from this one

Trait Implementations

impl<I: Clone + Interface + AsRef<Proxy<I>> + From<Proxy<I>>> Clone for Main<I>[src]

impl<I: Interface> Debug for Main<I> where
    I: Debug + AsRef<Proxy<I>> + From<Proxy<I>>, 
[src]

impl<I: Interface> Deref for Main<I> where
    I: AsRef<Proxy<I>> + From<Proxy<I>>, 
[src]

type Target = Attached<I>

The resulting type after dereferencing.

impl<I: Interface> From<Main<I>> for Attached<I> where
    I: AsRef<Proxy<I>> + From<Proxy<I>>, 
[src]

impl<I: PartialEq + Interface + AsRef<Proxy<I>> + From<Proxy<I>>> PartialEq<Main<I>> for Main<I>[src]

impl<I: Interface + AsRef<Proxy<I>> + From<Proxy<I>>> StructuralPartialEq for Main<I>[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.