[][src]Trait libzmq::prelude::RecvMsg

pub trait RecvMsg: GetRawSocket {
    fn recv(&self, msg: &mut Msg) -> Result<(), Error> { ... }
fn try_recv(&self, msg: &mut Msg) -> Result<(), Error> { ... }
fn recv_msg(&self) -> Result<Msg, Error> { ... }
fn try_recv_msg(&self) -> Result<Msg, Error> { ... }
fn recv_hwm(&self) -> Result<i32, Error> { ... }
fn set_recv_hwm(&self, hwm: i32) -> Result<(), Error> { ... }
fn recv_timeout(&self) -> Result<Period, Error> { ... }
fn set_recv_timeout<P>(&self, period: P) -> Result<(), Error>
    where
        P: Into<Period>
, { ... } }

Receive atomic messages in an immutable, thread-safe fashion.

Does not support multipart messages.

Provided methods

fn recv(&self, msg: &mut Msg) -> Result<(), Error>

Retreive a message from the inbound socket queue.

This operation might block until the socket receives a message or, if it is set, until recv_timeout expires.

Error

The Msg is returned as the content of the Error.

Possible Error Variants

fn try_recv(&self, msg: &mut Msg) -> Result<(), Error>

Try to retrieve a message from the inbound socket queue without blocking.

This polls the socket to determine there is at least on inbound message in the socket queue. If there is, it retuns it, otherwise it errors with WouldBlock.

Error

No message from the inbound queue is lost if there is an error.

Possible Error Variants

fn recv_msg(&self) -> Result<Msg, Error>

A convenience function that allocates a Msg with the same properties as recv.

fn try_recv_msg(&self) -> Result<Msg, Error>

A convenience function that allocates a Msg with the same properties as try_recv.

fn recv_hwm(&self) -> Result<i32, Error>

The high water mark for incoming messages on the specified socket.

The high water mark is a hard limit on the maximum number of incoming messages ØMQ shall queue in memory.

If this limit has been reached the socket shall enter the mute state.

Default

1000

Example

use libzmq::{prelude::*, *};

let client = ClientBuilder::new().build()?;
assert_eq!(client.recv_hwm()?, 1000);

fn set_recv_hwm(&self, hwm: i32) -> Result<(), Error>

Set the high water mark for inbound messages on the specified socket.

The high water mark is a hard limit on the maximum number of outstanding messages ØMQ shall queue in memory.

If this limit has been reached the socket shall enter the mute state.

Usage Contract

  • The high water mark cannot be zero.

Returned Error

Default

1000

fn recv_timeout(&self) -> Result<Period, Error>

The timeout for [recv] on the socket.

If some timeout is specified, [recv] will return [WouldBlock] after the duration is elapsed. Otherwise it will until a message is received.

fn set_recv_timeout<P>(&self, period: P) -> Result<(), Error> where
    P: Into<Period>, 

Sets the timeout for [recv] on the socket.

If some timeout is specified, [recv] will return [WouldBlock] after the duration is elapsed. Otherwise it will until a message is received.

Default

Infinite

Loading content...

Implementors

impl RecvMsg for Client[src]

impl RecvMsg for Dish[src]

impl RecvMsg for Gather[src]

impl RecvMsg for Server[src]

Loading content...