Struct wayland_backend::rs::socket::BufferedSocket
source · pub struct BufferedSocket {
socket: Socket,
in_data: Buffer<u8>,
in_fds: VecDeque<OwnedFd>,
out_data: Buffer<u8>,
out_fds: Vec<OwnedFd>,
}
Expand description
An adapter around a raw Socket that directly handles buffering and conversion from/to wayland messages
Fields§
§socket: Socket
§in_data: Buffer<u8>
§in_fds: VecDeque<OwnedFd>
§out_data: Buffer<u8>
§out_fds: Vec<OwnedFd>
Implementations§
source§impl BufferedSocket
impl BufferedSocket
sourcepub fn flush(&mut self) -> IoResult<()>
pub fn flush(&mut self) -> IoResult<()>
Flush the contents of the outgoing buffer into the socket
fn attempt_write_message(&mut self, msg: &Message<u32, RawFd>) -> IoResult<bool>
sourcepub fn write_message(&mut self, msg: &Message<u32, RawFd>) -> IoResult<()>
pub fn write_message(&mut self, msg: &Message<u32, RawFd>) -> IoResult<()>
Write a message to the outgoing buffer
This method may flush the internal buffer if necessary (if it is full).
If the message is too big to fit in the buffer, the error Error::Sys(E2BIG)
will be returned.
sourcepub fn fill_incoming_buffers(&mut self) -> IoResult<()>
pub fn fill_incoming_buffers(&mut self) -> IoResult<()>
Try to fill the incoming buffers of this socket, to prepare a new round of parsing.
sourcepub fn read_one_message<F>(
&mut self,
signature: F,
) -> Result<Message<u32, OwnedFd>, MessageParseError>
pub fn read_one_message<F>( &mut self, signature: F, ) -> Result<Message<u32, OwnedFd>, MessageParseError>
Read and deserialize a single message from the incoming buffers socket
This method requires one closure that given an object id and an opcode,
must provide the signature of the associated request/event, in the form of
a &'static [ArgumentType]
.
Trait Implementations§
source§impl AsFd for BufferedSocket
impl AsFd for BufferedSocket
source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Borrows the file descriptor. Read more
source§impl AsRawFd for BufferedSocket
impl AsRawFd for BufferedSocket
Auto Trait Implementations§
impl Freeze for BufferedSocket
impl RefUnwindSafe for BufferedSocket
impl Send for BufferedSocket
impl Sync for BufferedSocket
impl Unpin for BufferedSocket
impl UnwindSafe for BufferedSocket
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.