pub struct Builder { /* private fields */ }
Expand description
Customized channel construction.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn bounded(&mut self, capacity: usize) -> &mut Self
pub fn bounded(&mut self, capacity: usize) -> &mut Self
Define this channel as bounded with the given capacity.
Because handles can be converted freely between sync and async, and Rust async is polling, unbuffered channels are not supported. A capacity of 0 is rounded up to 1.
Sourcepub fn preallocate(&mut self) -> &mut Self
pub fn preallocate(&mut self) -> &mut Self
Preallocate bounded channels with their full capacity. This avoids reallocation at runtime.
Has no effect on unbounded channels.
Sourcepub fn build_async<T>(&mut self) -> (Sender<T>, Receiver<T>)
pub fn build_async<T>(&mut self) -> (Sender<T>, Receiver<T>)
Allocates a channel and returns async sender and receiver handles.
Sourcepub fn build_sync<T>(&mut self) -> (SyncSender<T>, SyncReceiver<T>)
pub fn build_sync<T>(&mut self) -> (SyncSender<T>, SyncReceiver<T>)
Allocates a channel and returns the synchronous sender and receiver handles.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more