Struct yaque::queue::SenderBuilder

source ·
pub struct SenderBuilder { /* private fields */ }
Expand description

A builder for the sender side of the queue. Use this if you want to have fine-grained control over the configuration of the queue. Most defaults should be ok of most applications.

Implementations§

source§

impl SenderBuilder

source

pub fn new() -> SenderBuilder

Creates a new sender builder. Finish build it by invoking SenderBuilder::open.

source

pub fn segment_size(self, size: u64) -> SenderBuilder

The segment size in bytes that will trigger a new segment to be created. Segments an be bigger than this to accommodate the last element, but nothing beyond that (each segment must store at least one element).

Default value: 4 * 1024 * 1024, or 4MB.

Panics

This function panics if size is zero.

source

pub fn max_queue_size(self, size: Option<u64>) -> SenderBuilder

The queue size that will block the sender from creating a new segment (until the receiver catches up, deleting old segments). The queue can get bigger than that, but only to accommodate the last segment (the queue must have at least one segment). Set this to None to create an unbounded queue.

This value will be ignored if the queue has only one segment, since the queue would deadlock otherwise. It is recommended that you set max_queue_size >> segment_size.

Default value: None

Panics

This function panics if size is zero.

source

pub fn open<P: AsRef<Path>>(self, base: P) -> Result<Sender>

Opens a queue on a folder indicated by the base path for sending. The folder will be created if it does not already exist.

Errors

This function will return an IO error if the queue is already in use for sending, which is indicated by a lock file. Also, any other IO error encountered while opening will be sent.

Trait Implementations§

source§

impl Default for SenderBuilder

source§

fn default() -> SenderBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V