Struct wayland_server::Client
source · [−]pub struct Client { /* private fields */ }
Expand description
A handle to a client connected to your server
There can be several handles referring to the same client.
Implementations
sourceimpl Client
impl Client
sourcepub fn equals(&self, other: &Client) -> bool
pub fn equals(&self, other: &Client) -> bool
Checks whether self
and other
refer to the same client
sourcepub fn credentials(&self) -> Option<Credentials>
pub fn credentials(&self) -> Option<Credentials>
Returns the Credentials
from the socket of this
client.
The credentials come from getsockopt() with SO_PEERCRED, on the client socket fd.
Be aware that for clients that a compositor forks and execs and then connects using socketpair(), this function will return the credentials for the compositor. The credentials for the socketpair are set at creation time in the compositor.
Returns None if the client is already dead.
sourcepub fn data_map(&self) -> &UserDataMap
pub fn data_map(&self) -> &UserDataMap
Returns a reference to the UserDataMap
associated with this client
See UserDataMap
documentation for details about its use.
sourcepub fn add_destructor(&self, destructor: Filter<Arc<UserDataMap>>)
pub fn add_destructor(&self, destructor: Filter<Arc<UserDataMap>>)
Adds a destructor for this client
This filter will be called when the client disconnects or is killed.
It has access to the UserDataMap
associated with this client.
You can add several destructors which will all be called sequentially. Note that if you accidentally add two copies of the same closure, it will be called twice.
The destructors will be executed on the thread containing the wayland event loop.
Panics: This function will panic if called from an other thread than the one hosting the Display.
sourcepub fn create_resource<I: Interface + From<Resource<I>> + AsRef<Resource<I>>>(
&self,
version: u32
) -> Option<Main<I>>
pub fn create_resource<I: Interface + From<Resource<I>> + AsRef<Resource<I>>>(
&self,
version: u32
) -> Option<Main<I>>
Creates a new resource for this client
To ensure the state coherence between client and server, this resource should immediately be assigned to a filter and sent to the client through an appropriate event. Failure to do so will likely cause protocol errors.
Panics: This function will panic if called from an other thread than the one hosting the Display.
sourcepub fn get_resource<I: Interface + From<Resource<I>> + AsRef<Resource<I>>>(
&self,
id: u32
) -> Option<I>
pub fn get_resource<I: Interface + From<Resource<I>> + AsRef<Resource<I>>>(
&self,
id: u32
) -> Option<I>
Retrieve a resource of this client for a given id
You need to know in advance which is the interface of this object. If the given id does
not correspond to an existing object or the existing object is not of the requested
interface, this call returns None
.
Trait Implementations
sourceimpl PartialEq<Client> for Client
impl PartialEq<Client> for Client
impl StructuralPartialEq for Client
Auto Trait Implementations
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
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
sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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