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

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.

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

Attempt to recover the typed variant of an anonymous proxy

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

Create a non-attached handle from this one

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

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

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

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

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

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.