Struct wayland_client::Main

source ·
pub struct Main<I: Interface + AsRef<Proxy<I>> + From<Proxy<I>>> {
    inner: Attached<I>,
}
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.

Fields§

§inner: Attached<I>

Implementations§

source§

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

source

pub(crate) fn wrap(inner: ProxyInner) -> Main<I>

source

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.

source

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

source§

impl Main<AnonymousObject>

source

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

Attempt to recover the typed variant of an anonymous proxy

source§

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

source

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

source

pub fn detach(&self) -> I

Create a non-attached handle from this one

Trait Implementations§

source§

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

source§

fn clone(&self) -> Main<I>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

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

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

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

§

type Target = Attached<I>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Attached<I>

Dereferences the value.
source§

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

source§

fn from(main: Main<I>) -> Attached<I>

Converts to this type from the input type.
source§

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

source§

fn eq(&self, other: &Main<I>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.