pub struct Receiver<T>(_, _);

Implementations

Sets up a new ringbuffer and returns the receiver half.

Create a new ringbuffer with hugetlb support and returns the receiver half. Supports linux version 4.16+ only

Attaches to a ringbuffer set up by the sending side.

mlock the backing memory to avoid it being put into swap

Low-level access to the ringbuffer.

Note that reading directly using these methods will not trigger a signal for the sending side to wake up.

The file descriptor for the shared memory area

The file descriptor to register notification for in your favorite non-blocking framework (tokio, async-std etc).

It is written to by the sending side when the buffer is no longer empty.

The file descriptor written to when the sending side should wake up

Receives data from the ringbuffer.

Because this is a ringbuffer between untrusted processes we can never create references to the data, so we have to resort to raw pointers. The closure receives a (ptr, count) pair which can be read from using e g std::ptr::read, and returns the number of items that can be dropped from the ringbuffer. If the buffer is empty, the closure is not called. If there is more data that could be read (e g in another part of the ringbuffer), that is indicated in the returned Status struct.

Receives data from the ringbuffer.

The closure receives a slice of data and returns the number of items that can be dropped from the ringbuffer. If the buffer is empty, the closure is not called. If there is more data that could be read (e g in another part of the ringbuffer), that is indicated in the returned Status struct.

Safety

Caller must ensure that no one can read or write the data area, except for at most one Receiver (this one) and at most one Sender, both set up correctly.

For blocking scenarios, blocks until the channel is readable.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.