Trait runa_io::traits::ser::Serialize

pub trait Serialize {
    // Required methods
    fn serialize<Fds>(self, buf: &mut BytesMut, fds: &mut Fds)
       where Fds: Extend<OwnedFd>;
    fn len(&self) -> u16;
    fn nfds(&self) -> u8;
}
Expand description

A serialization trait, implemented by wayland message types.

We can’t use serde, because it doesn’t support passing file descriptors. Most of the serialization code is expected to be generated by scanner.

For now instead of a Serializer trait, we only serialize to bytes and fds, but this might change in the future.

Required Methods§

fn serialize<Fds>(self, buf: &mut BytesMut, fds: &mut Fds)where Fds: Extend<OwnedFd>,

Serialize into the buffered writer. This function returns no errors, failures in seializing are generally program errors, and triggers panicking.

Panic

If there is not enough space in the buffer, this function should panic - the user should have called poll_reserve before serializing, so this indicates programming error. If self contains file descriptors that aren’t OwnedFd, this function panics too.

fn len(&self) -> u16

How many bytes will this message serialize to. Including the 8 byte header.

fn nfds(&self) -> u8

How many file descriptors will this message serialize to.

Implementors§