[−][src]Struct wayland_server::NewResource
A newly-created resource that needs implementation
Whenever a new wayland object is created, you will
receive it as a NewResource. 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> NewResource<I>[src]
pub fn implement<T, Dest, UD>(
self,
handler: T,
destructor: Option<Dest>,
user_data: UD
) -> I where
T: 'static,
Dest: FnMut(I) + 'static,
UD: 'static,
I: HandledBy<T> + From<Resource<I>>,
I::Request: MessageGroup<Map = ResourceMap>, [src]
self,
handler: T,
destructor: Option<Dest>,
user_data: UD
) -> I where
T: 'static,
Dest: FnMut(I) + 'static,
UD: 'static,
I: HandledBy<T> + From<Resource<I>>,
I::Request: MessageGroup<Map = ResourceMap>,
Implement this resource using a handler, destructor and user data.
The handler is a struct implementing the RequestHandler trait for the corresponding
interface.
This must be called from the thread hosting the wayland event loop, otherwise it will panic.
pub fn implement_closure<F, Dest, UD>(
self,
implementation: F,
destructor: Option<Dest>,
user_data: UD
) -> I where
F: FnMut(I::Request, I) + 'static,
Dest: FnMut(I) + 'static,
UD: 'static,
I: From<Resource<I>>,
I::Request: MessageGroup<Map = ResourceMap>, [src]
self,
implementation: F,
destructor: Option<Dest>,
user_data: UD
) -> I where
F: FnMut(I::Request, I) + 'static,
Dest: FnMut(I) + 'static,
UD: 'static,
I: From<Resource<I>>,
I::Request: MessageGroup<Map = ResourceMap>,
Implement this resource using given function, destructor, and user data.
This must be called from the thread hosting the wayland event loop, otherwise it will panic.
pub fn implement_dummy(self) -> I where
I: From<Resource<I>>,
I::Request: MessageGroup<Map = ResourceMap>, [src]
I: From<Resource<I>>,
I::Request: MessageGroup<Map = ResourceMap>,
Implement this resource using a dummy handler which does nothing.
pub fn implement_threadsafe<T, Dest, UD>(
self,
handler: T,
destructor: Option<Dest>,
user_data: UD
) -> I where
T: Send + 'static,
Dest: FnMut(I) + Send + 'static,
UD: Send + Sync + 'static,
I: HandledBy<T> + From<Resource<I>>,
I::Request: MessageGroup<Map = ResourceMap>, [src]
self,
handler: T,
destructor: Option<Dest>,
user_data: UD
) -> I where
T: Send + 'static,
Dest: FnMut(I) + Send + 'static,
UD: Send + Sync + 'static,
I: HandledBy<T> + From<Resource<I>>,
I::Request: MessageGroup<Map = ResourceMap>,
Implement this resource using a handler, destructor and user data.
The handler is a struct implementing the RequestHandler trait for the corresponding
interface.
This method allows you to implement from any thread with the constraint that the implementation and user-data must be threadsafe.
pub fn implement_closure_threadsafe<F, Dest, UD>(
self,
implementation: F,
destructor: Option<Dest>,
user_data: UD
) -> I where
F: FnMut(I::Request, I) + Send + 'static,
Dest: FnMut(I) + Send + 'static,
UD: Send + Sync + 'static,
I: From<Resource<I>>,
I::Request: MessageGroup<Map = ResourceMap>, [src]
self,
implementation: F,
destructor: Option<Dest>,
user_data: UD
) -> I where
F: FnMut(I::Request, I) + Send + 'static,
Dest: FnMut(I) + Send + 'static,
UD: Send + Sync + 'static,
I: From<Resource<I>>,
I::Request: MessageGroup<Map = ResourceMap>,
Implement this resource using given function, destructor, and user data.
This method allows you to implement from any thread with the constraint that the implementation and user-data must be threadsafe.
Auto Trait Implementations
impl<I> !Send for NewResource<I>
impl<I> !Sync for NewResource<I>
Blanket Implementations
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T> From for T[src]
impl<T, U> TryFrom for T where
U: Into<T>, [src]
U: Into<T>,
type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Downcast for T where
T: Any, [src]
T: Any,