wayland_server

Struct DisplayHandle

source
pub struct DisplayHandle { /* private fields */ }
Expand description

A handle to the Wayland display

A display handle may be constructed from a Handle using it’s From implementation.

Implementations§

source§

impl DisplayHandle

source

pub fn backend_handle(&self) -> Handle

Returns the underlying Handle from wayland-backend.

source

pub fn insert_client( &mut self, stream: UnixStream, data: Arc<dyn ClientData>, ) -> Result<Client>

Insert a new client in your Display

This client will be associated with the provided ClientData, that you can then retrieve from it via Client::get_data(), and its requests will be processed by the Display and your callbacks.

source

pub fn get_client(&self, id: ObjectId) -> Result<Client, InvalidId>

Retrieve the Client which owns the object represented by the given ID

source

pub fn create_global<State, I: Resource + 'static, U: Send + Sync + 'static>( &self, version: u32, data: U, ) -> GlobalId
where State: GlobalDispatch<I, U> + 'static,

Create a new protocol global

This global will be advertized to clients through the wl_registry according to the rules defined by your GlobalDispatch implementation for the given interface. Whenever a client binds this global, the associated GlobalDispatch::bind() method will be invoked on your State.

source

pub fn disable_global<State: 'static>(&self, id: GlobalId)

Disable this global

Clients will be notified of the global removal, and it will not be advertized to new clients. However the state associated with this global is not freed, so clients which already know about it can still bind it.

source

pub fn remove_global<State: 'static>(&self, id: GlobalId)

Remove this global

Clients will be notified of the global removal if it was not already disabled. The state associated with this global is freed, meaning clients trying to bind it will receive a protocol error.

When removing a global, it is recommended to first disable it using disable_global() to allow some time for clients to register that the global is getting removed, to avoid a race where a client would be killed because it bound a global at the same as the server decided to remove it. After the global has been disabled for some time (like a few seconds) it should be safe to actually remove it.

source

pub fn object_info(&self, id: ObjectId) -> Result<ObjectInfo, InvalidId>

Access the protocol information for a Wayland object

Returns an error if the object is no longer valid.

source

pub fn send_event<I: Resource>( &self, resource: &I, event: I::Event<'_>, ) -> Result<(), InvalidId>

Send an event to given Wayland object

This is intended to be a low-level method. You can alternatively use the methods on the type representing your object, or Resource::send_event(), which may be more convenient.

source

pub fn post_error<I: Resource>(&self, resource: &I, code: u32, error: String)

Trigger a protocol error on this object

This is intended to be a low-level method. See Resource::post_error(), for a more convenient method.

source

pub fn get_object_data( &self, id: ObjectId, ) -> Result<Arc<dyn Any + Send + Sync + 'static>, InvalidId>

Access the object data associated with this object

This is intended to be a low-level method. See Resource::object_data(), for a more convenient method.

source

pub fn flush_clients(&mut self) -> Result<()>

Flush outgoing buffers into their respective sockets.

Trait Implementations§

source§

impl Clone for DisplayHandle

source§

fn clone(&self) -> DisplayHandle

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 Debug for DisplayHandle

source§

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

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

impl From<Handle> for DisplayHandle

source§

fn from(handle: Handle) -> Self

Creates a DisplayHandle using a Handle from wayland-backend.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

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

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

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

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

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where 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 T
where T: Clone,

source§

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 T
where U: Into<T>,

source§

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 T
where U: TryFrom<T>,

source§

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.