Struct par_stream::PullBuilder
source · [−]pub struct PullBuilder<St, K, F, Q = K> where
St: ?Sized + Stream, { /* private fields */ }
Expand description
The builder forwards each stream item according to its key to a destination receiver.
Implementations
sourceimpl<St, K, Q, F> PullBuilder<St, K, F, Q> where
St: 'static + Send + Stream,
St::Item: 'static + Send,
F: 'static + Send + FnMut(&St::Item) -> Q,
K: 'static + Send + Hash + Eq + Borrow<Q>,
Q: Send + Hash + Eq,
impl<St, K, Q, F> PullBuilder<St, K, F, Q> where
St: 'static + Send + Stream,
St::Item: 'static + Send,
F: 'static + Send + FnMut(&St::Item) -> Q,
K: 'static + Send + Hash + Eq + Borrow<Q>,
Q: Send + Hash + Eq,
sourcepub fn new<B>(stream: St, buf_size: B, key_fn: F) -> Self where
B: Into<BufSize>,
pub fn new<B>(stream: St, buf_size: B, key_fn: F) -> Self where
B: Into<BufSize>,
Creates the builder.
The buf_size
sets the channel size for each registered receiver.
The key_fn
is used to compute the key for each input item.
sourcepub fn register(&mut self, key: K) -> Option<RecvStream<'static, St::Item>>
pub fn register(&mut self, key: K) -> Option<RecvStream<'static, St::Item>>
Creates a receiver binding to the key
.
If the key
is already registered, it returns None
.
sourcepub fn build(self) -> RecvStream<'static, St::Item>
pub fn build(self) -> RecvStream<'static, St::Item>
Finish the builder and start forwarding items to receivers.
It returns a special leaking receiver that accepts items which key is not registered or the destination receiver is closed.
Auto Trait Implementations
impl<St: ?Sized, K, F, Q> RefUnwindSafe for PullBuilder<St, K, F, Q> where
F: RefUnwindSafe,
K: RefUnwindSafe,
Q: RefUnwindSafe,
St: RefUnwindSafe,
impl<St: ?Sized, K, F, Q> Send for PullBuilder<St, K, F, Q> where
F: Send,
K: Send,
Q: Send,
St: Send,
<St as Stream>::Item: Send,
impl<St: ?Sized, K, F, Q> Sync for PullBuilder<St, K, F, Q> where
F: Sync,
K: Sync,
Q: Sync,
St: Sync,
<St as Stream>::Item: Send,
impl<St: ?Sized, K, F, Q> Unpin for PullBuilder<St, K, F, Q> where
F: Unpin,
K: Unpin,
Q: Unpin,
St: Unpin,
impl<St: ?Sized, K, F, Q> UnwindSafe for PullBuilder<St, K, F, Q> where
F: UnwindSafe,
K: UnwindSafe,
Q: UnwindSafe,
St: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more