Struct wayland_client::backend::Handle
source · [−]pub struct Handle { /* private fields */ }
Expand description
Main handle of a backend to the Wayland protocol
This type hosts most of the protocol-related functionality of the backend, and is the
main entry point for manipulating Wayland objects. It can be retrieved both from
the backend via Backend::handle()
, and is given to you as argument
in most event callbacks.
Implementations
Get the object ID for the wl_display
Get the last error that occurred on this backend
If this returns an error, your Wayland connection is already dead.
Get the detailed information about a wayland object
Returns an error if the provided object ID is no longer valid.
Create a null object ID
This object ID is always invalid, and can be used as placeholder.
Create a placeholder ID for object creation
This ID needs to be created beforehand and given as argument to a request creating a
new object ID. A specification must be specified if the interface and version cannot
be inferred from the protocol (for example object creation from the wl_registry
).
If a specification is provided it’ll be checked against what can be deduced from the
protocol specification, and send_request
will panic if they
do not match.
pub fn send_request(
&mut self,
Message<ObjectId>,
data: Option<Arc<dyn ObjectData + 'static>>
) -> Result<ObjectId, InvalidId>
pub fn send_request(
&mut self,
Message<ObjectId>,
data: Option<Arc<dyn ObjectData + 'static>>
) -> Result<ObjectId, InvalidId>
Sends a request to the server
Returns an error if the sender ID of the provided message is no longer valid.
Panic:
Several checks against the protocol specification are done, and this method will panic if they do not pass:
- the message opcode must be valid for the sender interface
- the argument list must match the prototype for the message associated with this opcode
- if the method creates a new object, a
placeholder_id()
must be given in the argument list, either without a specification, or with a specification that matches the interface and version deduced from the protocol rules
Access the object data associated with a given object ID
Returns an error if the object ID is not longer valid
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Handle
impl !UnwindSafe for Handle
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: 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
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub 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
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub 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