x11rb::x11_utils

Trait TryParseFd

pub trait TryParseFd: Sized {
    // Required method
    fn try_parse_fd<'a>(
        value: &'a [u8],
        fds: &mut Vec<OwnedFd>,
    ) -> Result<(Self, &'a [u8]), ParseError>;
}
Expand description

A type implementing this trait can be parsed from some raw bytes and a list of fds.

Required Methods§

fn try_parse_fd<'a>( value: &'a [u8], fds: &mut Vec<OwnedFd>, ) -> Result<(Self, &'a [u8]), ParseError>

Try to parse the given values into an instance of this type.

File descriptors are consumed by removing them from the beginning of the given fds Vec. If a file descriptor is expected, but missing, a ParseError should be returned. If more file descriptors are provided than expected, this is not an error and the remaining descriptors should be left in the Vec.

If parsing is successful, an instance of the type and a slice for the remaining data should be returned. Otherwise, an error is returned.

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.

Implementors§