Skip to main content

UdsxUnixStream

Trait UdsxUnixStream 

Source
pub trait UdsxUnixStream {
    // Required methods
    fn send_streams<B, I>(&self, id: B, streams: I) -> Result<()>
       where B: AsRef<[u8]>,
             I: IntoIterator<Item = RawFd>;
    fn send_ioe<B>(&self, id: B) -> Result<()>
       where B: AsRef<[u8]>;
    unsafe fn recv_streams<B, T>(&self, id: B, count: usize) -> Result<Vec<T>>
       where B: AsRef<[u8]>,
             T: FromRawFd;
    unsafe fn recv_ioe<B>(&self, id: B) -> Result<(Stdio, Stdio, Stdio)>
       where B: AsRef<[u8]>;
}
Expand description

§Extensions for UnixStream

§Notes

  • IDs are used for verification, they must not be empty.
  • In tests, IDs with size from one byte up to 64 bytes work fine. So you can use something like SHA3-512 hashes as your IDs.

Required Methods§

Source

fn send_streams<B, I>(&self, id: B, streams: I) -> Result<()>
where B: AsRef<[u8]>, I: IntoIterator<Item = RawFd>,

§Sends streams
§Notes

Too much streams will make an error (see cmsg(3)).

§See also

recv_streams()

Source

fn send_ioe<B>(&self, id: B) -> Result<()>
where B: AsRef<[u8]>,

§Sends all standard streams: input, output, error
§See also

recv_ioe()

Source

unsafe fn recv_streams<B, T>(&self, id: B, count: usize) -> Result<Vec<T>>
where B: AsRef<[u8]>, T: FromRawFd,

§Receives streams

count is number of streams you want to receive. This must match what client sends.

§See also

send_streams()

Source

unsafe fn recv_ioe<B>(&self, id: B) -> Result<(Stdio, Stdio, Stdio)>
where B: AsRef<[u8]>,

§Receives standard streams sent by send_ioe()

Results are: input, output and error streams.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl UdsxUnixStream for UnixStream

Source§

fn send_streams<B, I>(&self, id: B, streams: I) -> Result<()>
where B: AsRef<[u8]>, I: IntoIterator<Item = RawFd>,

Source§

fn send_ioe<B>(&self, id: B) -> Result<()>
where B: AsRef<[u8]>,

Source§

unsafe fn recv_streams<B, T>(&self, id: B, count: usize) -> Result<Vec<T>>
where B: AsRef<[u8]>, T: FromRawFd,

Source§

unsafe fn recv_ioe<B>(&self, id: B) -> Result<(Stdio, Stdio, Stdio)>
where B: AsRef<[u8]>,

Implementors§