shell_compose

Trait SocketExt

source
pub trait SocketExt {
    // Required methods
    fn read_serde<T: DeserializeOwned>(
        &mut self,
    ) -> Result<T, IpcStreamReadError>;
    fn write_serde<T: Serialize>(
        &mut self,
        data: &T,
    ) -> Result<(), IpcStreamWriteError>;
}

Required Methods§

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl SocketExt for LocalSocketStream

source§

fn read_serde<T: DeserializeOwned>(&mut self) -> Result<T, IpcStreamReadError>

Read a serializable object from the socket.

This reads a u32 in little endian, then reads that many bytes from the socket, then deserializes the data using bincode::deserialize.

source§

fn write_serde<T: Serialize>( &mut self, data: &T, ) -> Result<(), IpcStreamWriteError>

Write a serializable object to the socket.

This serializes the data using bincode::serialize, writes the length of the serialized data as a u32 in little endian, then writes the serialized data.

Implementors§