[][src]Struct wayland_client::NewProxy

pub struct NewProxy<I: Interface> { /* fields omitted */ }

A newly-created proxy that needs implementation

Whenever a new wayland object is created, you will receive it as a NewProxy. You then have to provide an implementation for it, in order to process the incoming events it may receive. Once this done you will be able to use it as a regular Rust object.

Implementations are structs implementing the appropriate variant of the Implementation trait. They can also be closures.

Methods

impl<I: Interface + 'static> NewProxy<I>[src]

pub fn implement<T, UD>(self, handler: T, user_data: UD) -> I where
    T: 'static,
    UD: 'static,
    I: HandledBy<T> + From<Proxy<I>>,
    I::Event: MessageGroup<Map = ProxyMap>, 
[src]

Implement this proxy using the given handler and implementation data.

The handler must be a struct implementing the EventHandler trait of the I interface.

This must be called from the same thread as the one owning the event queue this new proxy is attached to and will panic otherwise. A proxy by default inherits the event queue of its parent object.

If you don't want an object to inherits its parent queue, see Proxy::make_wrapper

pub fn implement_closure<F, UD>(self, implementation: F, user_data: UD) -> I where
    F: FnMut(I::Event, I) + 'static,
    UD: 'static,
    I: From<Proxy<I>>,
    I::Event: MessageGroup<Map = ProxyMap>, 
[src]

Implement this proxy using the given implementation closure and implementation data.

This must be called from the same thread as the one owning the event queue this new proxy is attached to and will panic otherwise. A proxy by default inherits the event queue of its parent object.

If you don't want an object to inherits its parent queue, see Proxy::make_wrapper

pub fn implement_dummy(self) -> I where
    I: From<Proxy<I>>,
    I::Event: MessageGroup<Map = ProxyMap>, 
[src]

Implement this proxy using a dummy handler which does nothing.

pub fn implement_threadsafe<T, UD>(self, handler: T, user_data: UD) -> I where
    T: Send + 'static,
    UD: Send + Sync + 'static,
    I: HandledBy<T> + From<Proxy<I>>,
    I::Event: MessageGroup<Map = ProxyMap>, 
[src]

Implement this proxy using the given handler and implementation data.

The handler must be a struct implementing the EventHandler trait of the I interface.

This function allows you to implement a proxy from an other thread than the one where its event queue is attach, but the implementation thus must be Send.

pub fn implement_closure_threadsafe<F, UD>(
    self,
    implementation: F,
    user_data: UD
) -> I where
    F: FnMut(I::Event, I) + Send + 'static,
    UD: Send + Sync + 'static,
    I: From<Proxy<I>>,
    I::Event: MessageGroup<Map = ProxyMap>, 
[src]

Implement this proxy using given closure and implementation data from any thread.

This function allows you to implement a proxy from an other thread than the one where its event queue is attach, but the implementation thus must be Send.

Auto Trait Implementations

impl<I> !Send for NewProxy<I>

impl<I> !Sync for NewProxy<I>

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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