Trait Serialize
pub trait Serialize {
type Bytes;
// Required methods
fn serialize(&self) -> Self::Bytes;
fn serialize_into(&self, bytes: &mut Vec<u8>);
}Expand description
A type implementing this trait can be serialized into X11 raw bytes.
Required Associated Types§
type Bytes
type Bytes
The value returned by serialize.
This should be Vec<u8> in most cases. However, arrays like [u8; 4] should also be
allowed and thus this is an associated type.
If generic associated types were available, implementing AsRef<[u8]> would be required.
Required Methods§
fn serialize_into(&self, bytes: &mut Vec<u8>)
fn serialize_into(&self, bytes: &mut Vec<u8>)
Serialize this value into X11 raw bytes, appending the result into bytes.
When calling this method, the given vector must satisfy assert_eq!(bytes.len() % 4, 0);.
In words: Its length must be a multiple of four.