pub trait MessageGroup: Sized {
type Map;
const MESSAGES: &'static [MessageDesc];
// Required methods
fn opcode(&self) -> u16;
fn is_destructor(&self) -> bool;
fn since(&self) -> u32;
fn child<Meta: ObjectMetadata>(
opcode: u16,
version: u32,
meta: &Meta,
) -> Option<Object<Meta>>;
fn from_raw(msg: Message, map: &mut Self::Map) -> Result<Self, ()>;
fn into_raw(self, send_id: u32) -> Message;
unsafe fn from_raw_c(
obj: *mut c_void,
opcode: u32,
args: *const wl_argument,
) -> Result<Self, ()>;
fn as_raw_c_in<F, T>(self, f: F) -> T
where F: FnOnce(u32, &mut [wl_argument]) -> T;
}
Expand description
A group of messages
This represents a group of message that can be serialized on the protocol wire. Typically the set of events or requests of a single interface.
Implementations of this trait are supposed to be
generated using the wayland-scanner
crate.
Required Associated Constants§
Sourceconst MESSAGES: &'static [MessageDesc]
const MESSAGES: &'static [MessageDesc]
Wire representation of this MessageGroup
Required Associated Types§
Required Methods§
Sourcefn is_destructor(&self) -> bool
fn is_destructor(&self) -> bool
Whether this message is a destructor
If it is, once send or receive the associated object cannot be used any more.
Sourcefn child<Meta: ObjectMetadata>(
opcode: u16,
version: u32,
meta: &Meta,
) -> Option<Object<Meta>>
fn child<Meta: ObjectMetadata>( opcode: u16, version: u32, meta: &Meta, ) -> Option<Object<Meta>>
Retrieve the child Object
associated with this message if any
Sourcefn from_raw(msg: Message, map: &mut Self::Map) -> Result<Self, ()>
fn from_raw(msg: Message, map: &mut Self::Map) -> Result<Self, ()>
Construct a message from its raw representation
Sourceunsafe fn from_raw_c(
obj: *mut c_void,
opcode: u32,
args: *const wl_argument,
) -> Result<Self, ()>
unsafe fn from_raw_c( obj: *mut c_void, opcode: u32, args: *const wl_argument, ) -> Result<Self, ()>
Construct a message of this group from its C representation
§Safety
The pointers provided to this function must all be valid pointers from
libwayland-client
Sourcefn as_raw_c_in<F, T>(self, f: F) -> T
fn as_raw_c_in<F, T>(self, f: F) -> T
Build a C representation of this message
It can only be accessed from the provided closure, and this consumes the message.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.