pub trait Receiver<I> where
    I: Instant
{ type Transport: Transport; type Driver; type Error: Debug + From<OutOfMemoryError>; fn receive(
        &mut self,
        now: I,
        driver: &mut Self::Driver
    ) -> Result<Option<Transfer<Vec<u8, Global>, I, Self::Transport>>, Self::Error>; fn subscribe_message(
        &mut self,
        subject: SubjectId,
        payload_size_max: usize,
        timeout: <I as Instant>::Duration,
        driver: &mut Self::Driver
    ) -> Result<(), Self::Error>; fn unsubscribe_message(
        &mut self,
        subject: SubjectId,
        driver: &mut Self::Driver
    ); fn subscribe_request(
        &mut self,
        service: ServiceId,
        payload_size_max: usize,
        timeout: <I as Instant>::Duration,
        driver: &mut Self::Driver
    ) -> Result<(), ServiceSubscribeError<Self::Error>>; fn unsubscribe_request(
        &mut self,
        service: ServiceId,
        driver: &mut Self::Driver
    ); fn subscribe_response(
        &mut self,
        service: ServiceId,
        payload_size_max: usize,
        timeout: <I as Instant>::Duration,
        driver: &mut Self::Driver
    ) -> Result<(), ServiceSubscribeError<Self::Error>>; fn unsubscribe_response(
        &mut self,
        service: ServiceId,
        driver: &mut Self::Driver
    ); }
Expand description

A receiver that can assemble incoming frames into transfers

Associated Types

The transport that this transmitter works with

The driver type that this transmitter uses to receive frames

An error type

This type must have an out-of-memory variant that can hold an OutOfMemoryError.

Required methods

Checks for incoming frames and processes them, possibly returning a transfer

If the frame completes a transfer and the transfer matches an active subscription, the transfer is returned.

This function must not block. If no frame can immediately be read, it should return Ok(None).

If the transport reads a frame and processes it, but the frame does not complete a transfer, this function must try again to read and process a frame. It must not return Ok(None) if there are incoming frames that remain to be processed.

This function must not return any transfers for which the transport is not currently subscribed. It also must not return any service transfers not addressed to this node.

The argument now should be the current time. This may be used to assign timestamps to incoming frames and delete sessions that have timed out.

Subscribes to messages on a subject

This will enable incoming transfers from all nodes on the specified subject ID.

subject: The subject ID to subscribe to

payload_size_max: The maximum number of payload bytes expected on this subject (longer transfers will be dropped)

timeout: The maximum time between the first and last frames in a transfer (transfers that do not finish within this time will be dropped)

If all transfers fit into one frame, the timeout has no meaning and may be zero.

Unsubscribes from messages on a subject

Subscribes to requests for a service

This will enable incoming service request transfers from all nodes on the specified service ID.

service: The service ID to subscribe to

payload_size_max: The maximum number of payload bytes expected on this subject (longer transfers will be dropped)

timeout: The maximum time between the first and last frames in a transfer (transfers that do not finish within this time will be dropped)

If all transfers fit into one frame, the timeout has no meaning and may be zero.

This function returns an error if this node is anonymous or some other transport error occurs.

Unsubscribes from requests for a service

Subscribes to responses for a service

This will enable incoming service response transfers from all nodes on the specified service ID.

service: The service ID to subscribe to

payload_size_max: The maximum number of payload bytes expected on this subject (longer transfers will be dropped)

timeout: The maximum time between the first and last frames in a transfer (transfers that do not finish within this time will be dropped)

If all transfers fit into one frame, the timeout has no meaning and may be zero.

This function returns an error if this node is anonymous or some other transport error occurs.

Unsubscribes from responses for a service

Implementors