pub struct Socket { /* private fields */ }
Expand description

A wayland socket

Implementations§

source§

impl Socket

source

pub fn send_msg(&self, bytes: &[u8], fds: &[RawFd]) -> NixResult<()>

Send a single message to the socket

A single socket message can contain several wayland messages

The fds slice should not be longer than MAX_FDS_OUT, and the bytes slice should not be longer than MAX_BYTES_OUT otherwise the receiving end may lose some data.

source

pub fn rcv_msg( &self, buffer: &mut [u8], fds: &mut [RawFd] ) -> NixResult<(usize, usize)>

Receive a single message from the socket

Return the number of bytes received and the number of Fds received.

Errors with WouldBlock is no message is available.

A single socket message can contain several wayland messages.

The buffer slice should be at least MAX_BYTES_OUT long and the fds slice MAX_FDS_OUT long, otherwise some data of the received message may be lost.

source

pub fn opt<O: GetSockOpt>(&self, opt: O) -> NixResult<O::Val>

Retrieve the current value of the requested socket::GetSockOpt

Trait Implementations§

source§

impl AsRawFd for Socket

source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
source§

impl Debug for Socket

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Socket

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl FromRawFd for Socket

source§

unsafe fn from_raw_fd(fd: RawFd) -> Socket

Constructs a new instance of Self from the given raw file descriptor. Read more
source§

impl IntoRawFd for Socket

source§

fn into_raw_fd(self) -> RawFd

Consumes this object, returning the raw underlying file descriptor. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.