Skip to main content

QueueChannel

Struct QueueChannel 

Source
pub struct QueueChannel<OutElem, InElem, R: 'static>
where OutElem: Send + Clone + 'static, InElem: Send + 'static,
{ /* private fields */ }
Expand description

Queue-backed channel without stream or fold variants — always Send + Sync when element types are Send, unlike Channel (whose ChannelState includes stream drivers that are not Send).

Implementations§

Source§

impl<OutElem, InElem, R> QueueChannel<OutElem, InElem, R>
where OutElem: Send + Clone + 'static, InElem: Send + 'static, R: 'static,

Source

pub fn from_queue_and_map( q: Queue<OutElem>, map_in: impl Fn(InElem) -> OutElem + Send + Sync + 'static, ) -> Self

Same wire shape as Channel::from_queue_and_map, but only the queue implementation exists.

Source

pub fn shutdown(&self) -> Effect<(), (), ()>

Close the backing queue to producers; buffered values remain available to Self::read.

Source

pub fn read(&self) -> Effect<Option<OutElem>, QueueError, R>

Read the next element, or None when the queue has ended / disconnected.

Source

pub fn write(&self, value: InElem) -> Effect<(), (), R>

Enqueue one mapped element.

Source§

impl<T, R> QueueChannel<T, T, R>
where T: Send + Clone + 'static, R: 'static,

Source

pub fn duplex_unbounded() -> Effect<QueueChannel<T, T, R>, (), ()>

Unbounded duplex with identity map-in (same as Channel::duplex_unbounded for the queue case).

Source

pub fn to_stream(&self) -> Stream<T, QueueError, R>

Same drain semantics as Channel::to_stream: one bootstrap pull over QueueChannel::read.

Call QueueChannel::shutdown when no further writes are expected so Stream::run_collect can finish.

Trait Implementations§

Source§

impl<OutElem, InElem, R> Clone for QueueChannel<OutElem, InElem, R>
where OutElem: Send + Clone + 'static, InElem: Send + 'static, R: 'static,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<OutElem, InElem, R> Freeze for QueueChannel<OutElem, InElem, R>

§

impl<OutElem, InElem, R> !RefUnwindSafe for QueueChannel<OutElem, InElem, R>

§

impl<OutElem, InElem, R> Send for QueueChannel<OutElem, InElem, R>

§

impl<OutElem, InElem, R> Sync for QueueChannel<OutElem, InElem, R>

§

impl<OutElem, InElem, R> Unpin for QueueChannel<OutElem, InElem, R>

§

impl<OutElem, InElem, R> UnsafeUnpin for QueueChannel<OutElem, InElem, R>

§

impl<OutElem, InElem, R> !UnwindSafe for QueueChannel<OutElem, InElem, R>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> Pipe for T

Source§

fn pipe<F, R>(self, f: F) -> R
where F: FnOnce(Self) -> R,

Applies f to self (F#-style forward pipe).
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.