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

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