RatmanStreamExtV1

Trait RatmanStreamExtV1 

Source
pub trait RatmanStreamExtV1: RatmanIpcExtV1 {
    // Required methods
    fn send_to<'life0, 'async_trait, I>(
        self: &'life0 Arc<Self>,
        auth: AddrAuth,
        letterhead: LetterheadV1,
        data_reader: I,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where I: 'async_trait + AsyncRead + Unpin + Send,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn send_many<'life0, 'async_trait, I>(
        self: &'life0 Arc<Self>,
        auth: AddrAuth,
        letterheads: Vec<LetterheadV1>,
        data_reader: I,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where I: 'async_trait + AsyncRead + Unpin + Send,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn recv_one<'s, 'async_trait>(
        self: &'s Arc<Self>,
        auth: AddrAuth,
        addr: Address,
        to: Recipient,
    ) -> Pin<Box<dyn Future<Output = Result<(LetterheadV1, ReadStream<'s>)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             's: 'async_trait;
    fn recv_many<'s, 'async_trait>(
        self: &'s Arc<Self>,
        auth: AddrAuth,
        addr: Address,
        to: Recipient,
        num: Option<u32>,
    ) -> Pin<Box<dyn Future<Output = Result<StreamGenerator<'s>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             's: 'async_trait;
}

Required Methods§

Source

fn send_to<'life0, 'async_trait, I>( self: &'life0 Arc<Self>, auth: AddrAuth, letterhead: LetterheadV1, data_reader: I, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where I: 'async_trait + AsyncRead + Unpin + Send, Self: 'async_trait, 'life0: 'async_trait,

Send a message stream to a single address on the network

A send action needs a valid authentication token for the address that it is being sent from. The letterhead contains metadata about the stream: what address is sending where, and how much.

Optionally you can call .add_send_time() on the letterhead before passing it to this function to include the current time in the stream for the receiving client.

Source

fn send_many<'life0, 'async_trait, I>( self: &'life0 Arc<Self>, auth: AddrAuth, letterheads: Vec<LetterheadV1>, data_reader: I, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where I: 'async_trait + AsyncRead + Unpin + Send, Self: 'async_trait, 'life0: 'async_trait,

Send the same message stream to multiple recipients

Most of the Letterhead

Source

fn recv_one<'s, 'async_trait>( self: &'s Arc<Self>, auth: AddrAuth, addr: Address, to: Recipient, ) -> Pin<Box<dyn Future<Output = Result<(LetterheadV1, ReadStream<'s>)>> + Send + 'async_trait>>
where Self: 'async_trait, 's: 'async_trait,

Block this task/ socket to wait for a single incoming message stream

This function returns a single stream letterhead (which indicates the sender, receiver, and metadata such as stream length) and an async reader, which can then be used to read the stream to some buffer or writer stream.

Reading more bytes than letterhead.payload_length indicates is undefined behaviour! You must drop the ReadStream after you’re done reading to make the socket available to other API exchanges again!

If you need to receive data more consistently consider setting up a subscription!

Source

fn recv_many<'s, 'async_trait>( self: &'s Arc<Self>, auth: AddrAuth, addr: Address, to: Recipient, num: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<StreamGenerator<'s>>> + Send + 'async_trait>>
where Self: 'async_trait, 's: 'async_trait,

Return an iterator over a stream of letterheads and read streams

This function returns an iterator over incoming letterheads and read handles, which MUST be dropped at the end of your iterator closure to avoid deadlocking the next receive. Reading more bytes than letterhead.payload_length is undefined behaviour!

If you need to receive data more consistently consider setting up a subscription!

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§