pub struct Source<Out, Mat = NotUsed> { /* private fields */ }Implementations§
Source§impl<T: Send + 'static> Source<T, NotUsed>
impl<T: Send + 'static> Source<T, NotUsed>
Sourcepub fn queue_bounded(capacity: usize) -> Source<T, BoundedSourceQueue<T>>
pub fn queue_bounded(capacity: usize) -> Source<T, BoundedSourceQueue<T>>
A source fed by an external BoundedSourceQueue handle (lock-free, no overflow strategy;
a full buffer drops). Panics if capacity == 0.
Sourcepub fn queue(
capacity: usize,
strategy: OverflowStrategy,
) -> Source<T, SourceQueue<T>>
pub fn queue( capacity: usize, strategy: OverflowStrategy, ) -> Source<T, SourceQueue<T>>
A source fed by an external SourceQueue handle that applies strategy on overflow.
Panics if capacity == 0.
Source§impl<Out: Send + 'static, Mat: Send + 'static> Source<Out, Mat>
impl<Out: Send + 'static, Mat: Send + 'static> Source<Out, Mat>
pub fn buffer(self, size: usize, strategy: OverflowStrategy) -> Self
pub fn conflate_with_seed<Agg, Seed, Aggregate>( self, seed: Seed, aggregate: Aggregate, ) -> Source<Agg, Mat>
pub fn conflate( self, aggregate: impl Fn(Out, Out) -> Out + Send + Sync + 'static, ) -> Self
pub fn batch<Agg, Seed, Aggregate>( self, max: u64, seed: Seed, aggregate: Aggregate, ) -> Source<Agg, Mat>
pub fn batch_weighted<Agg, Cost, Seed, Aggregate>( self, max: u64, cost_fn: Cost, seed: Seed, aggregate: Aggregate, ) -> Source<Agg, Mat>
pub fn expand<Next, Expand, Iter>(self, expand: Expand) -> Source<Next, Mat>
pub fn extrapolate<Expand, Iter>( self, extrapolator: Expand, initial: Option<Out>, ) -> Self
pub fn aggregate_with_boundary<Agg, Emit, Allocate, Aggregate, Harvest>( self, allocate: Allocate, aggregate: Aggregate, harvest: Harvest, emit_on_timer: Option<AggregateTimer<Agg>>, ) -> Source<Emit, Mat>
pub fn detach(self) -> Self
Source§impl<Out: Send + 'static> Source<Out, NotUsed>
impl<Out: Send + 'static> Source<Out, NotUsed>
pub fn empty() -> Self
pub fn never() -> Self
pub fn failed(error: StreamError) -> Self
pub fn future<F, Fut>(future: F) -> Self
pub fn future_source<F, Fut>(future: F) -> Self
pub fn cycle<F, I>(factory: F) -> Self
pub fn unfold<State, F>(initial: State, f: F) -> Self
pub fn unfold_async<State, F, Fut>(initial: State, f: F) -> Self
pub fn unfold_resource<Resource, Create, Read, Close>(
create: Create,
read: Read,
close: Close,
) -> Selfwhere
Resource: Send + 'static,
Create: Fn() -> StreamResult<Resource> + Send + Sync + 'static,
Read: Fn(&mut Resource) -> StreamResult<Option<Out>> + Send + Sync + 'static,
Close: Fn(Resource) -> StreamResult<()> + Send + Sync + 'static,
pub fn unfold_resource_async<Resource, Create, CreateFut, Read, ReadFut, Close, CloseFut>(
create: Create,
read: Read,
close: Close,
) -> Selfwhere
Resource: Send + 'static,
Create: Fn() -> CreateFut + Send + Sync + 'static,
CreateFut: Future<Output = StreamResult<Resource>> + Send + 'static,
Read: Fn(&mut Resource) -> ReadFut + Send + Sync + 'static,
ReadFut: Future<Output = StreamResult<Option<Out>>> + Send + 'static,
Close: Fn(Resource) -> CloseFut + Send + Sync + 'static,
CloseFut: Future<Output = StreamResult<()>> + Send + 'static,
pub fn lazy_single<F>(create: F) -> Self
pub fn lazy_future<F, Fut>(create: F) -> Self
pub fn lazy_source<InnerMat, F>( create: F, ) -> Source<Out, StreamCompletion<InnerMat>>
pub fn lazy_future_source<InnerMat, F, Fut>( create: F, ) -> Source<Out, StreamCompletion<InnerMat>>
pub fn from_fn_iter<F, I>(factory: F) -> Self
Source§impl<Out: Send + 'static, Mat: Send + 'static> Source<Out, Mat>
impl<Out: Send + 'static, Mat: Send + 'static> Source<Out, Mat>
pub fn as_source_with_context<Ctx, F>( self, extract_context: F, ) -> SourceWithContext<Out, Ctx, Mat>
pub fn via<Next, FlowMat>( self, flow: Flow<Out, Next, FlowMat>, ) -> Source<Next, Mat>
pub fn via_mat<Next, FlowMat, Combined, F>( self, flow: Flow<Out, Next, FlowMat>, combine: F, ) -> Source<Next, Combined>
pub fn via_mat_with<Next, FlowMat, Combined, F>( self, flow: Flow<Out, Next, FlowMat>, combine: F, ) -> Source<Next, Combined>
pub fn map<Next, F>(self, f: F) -> Source<Next, Mat>
pub fn attributes(&self) -> &Attributes
pub fn with_attributes(self, attributes: Attributes) -> Self
pub fn add_attributes(self, attributes: Attributes) -> Self
pub fn named(self, name: impl Into<String>) -> Self
Sourcepub fn async_boundary(self) -> Self
pub fn async_boundary(self) -> Self
Insert an async boundary after this source.
The boundary uses the same crate::AsyncBoundaryExecutionConfig defaults
as the GraphDSL AsyncBoundary runner and hands elements across a bounded
Ractor-backed queue. async_boundary is the Rust-friendly primary name;
Source::r#async is provided as the Akka-mirroring alias.
Sourcepub fn async(self) -> Self
pub fn async(self) -> Self
Akka-mirroring alias for Source::async_boundary.
Sourcepub fn async_boundary_with_config(
self,
config: AsyncBoundaryExecutionConfig,
) -> Self
pub fn async_boundary_with_config( self, config: AsyncBoundaryExecutionConfig, ) -> Self
Insert an async boundary with an explicit bounded handoff configuration.
config.buffer_size controls the number of elements that may be queued
between the upstream and downstream fused regions. A zero buffer is
rejected when the stream is materialized.
Sourcepub fn async_boundary_with_buffer(self, buffer_size: usize) -> Self
pub fn async_boundary_with_buffer(self, buffer_size: usize) -> Self
Insert an async boundary with a custom bounded handoff size.
pub fn try_map<Next, F>(self, f: F) -> Source<Next, Mat>
Sourcepub fn map_result<Next, F>(self, f: F) -> Source<Next, Mat>
👎Deprecated since 0.9.0: renamed to try_map (idiomatic); the _result name still works
pub fn map_result<Next, F>(self, f: F) -> Source<Next, Mat>
renamed to try_map (idiomatic); the _result name still works
Deprecated alias for Source::try_map.
pub fn map_result_with_supervision<Next, F>( self, f: F, decider: SupervisionDecider, ) -> Source<Next, Mat>
pub fn filter<F>(self, predicate: F) -> Source<Out, Mat>
pub fn try_filter<F>(self, predicate: F) -> Source<Out, Mat>
Sourcepub fn filter_result<F>(self, predicate: F) -> Source<Out, Mat>
👎Deprecated since 0.9.0: renamed to try_filter (idiomatic); the _result name still works
pub fn filter_result<F>(self, predicate: F) -> Source<Out, Mat>
renamed to try_filter (idiomatic); the _result name still works
Deprecated alias for Source::try_filter.
pub fn filter_result_with_supervision<F>( self, predicate: F, decider: SupervisionDecider, ) -> Source<Out, Mat>
pub fn filter_not<F>(self, predicate: F) -> Source<Out, Mat>
pub fn filter_map<Next, F>(self, f: F) -> Source<Next, Mat>
pub fn try_filter_map<Next, F>(self, f: F) -> Source<Next, Mat>
Sourcepub fn filter_map_result<Next, F>(self, f: F) -> Source<Next, Mat>
👎Deprecated since 0.9.0: renamed to try_filter_map (idiomatic); the _result name still works
pub fn filter_map_result<Next, F>(self, f: F) -> Source<Next, Mat>
renamed to try_filter_map (idiomatic); the _result name still works
Deprecated alias for Source::try_filter_map.
pub fn filter_map_result_with_supervision<Next, F>( self, f: F, decider: SupervisionDecider, ) -> Source<Next, Mat>
pub fn map_concat<Next, F, I>(self, f: F) -> Source<Next, Mat>
pub fn try_map_concat<Next, F, I>(self, f: F) -> Source<Next, Mat>where
Next: Send + 'static,
F: Fn(Out) -> StreamResult<I> + Send + Sync + 'static,
I: IntoIterator<Item = Next>,
I::IntoIter: Send + 'static,
Sourcepub fn map_concat_result<Next, F, I>(self, f: F) -> Source<Next, Mat>where
Next: Send + 'static,
F: Fn(Out) -> StreamResult<I> + Send + Sync + 'static,
I: IntoIterator<Item = Next>,
I::IntoIter: Send + 'static,
👎Deprecated since 0.9.0: renamed to try_map_concat (idiomatic); the _result name still works
pub fn map_concat_result<Next, F, I>(self, f: F) -> Source<Next, Mat>where
Next: Send + 'static,
F: Fn(Out) -> StreamResult<I> + Send + Sync + 'static,
I: IntoIterator<Item = Next>,
I::IntoIter: Send + 'static,
renamed to try_map_concat (idiomatic); the _result name still works
Deprecated alias for Source::try_map_concat.
pub fn map_concat_result_with_supervision<Next, F, I>(
self,
f: F,
decider: SupervisionDecider,
) -> Source<Next, Mat>where
Next: Send + 'static,
F: Fn(Out) -> StreamResult<I> + Send + Sync + 'static,
I: IntoIterator<Item = Next>,
I::IntoIter: Send + 'static,
pub fn stateful_map<State, Next, F>( self, seed: State, f: F, ) -> Source<Next, Mat>
pub fn try_stateful_map<State, Next, F>(
self,
seed: State,
f: F,
) -> Source<Next, Mat>where
State: Clone + Send + Sync + 'static,
Next: Send + 'static,
F: Fn(&mut State, Out) -> StreamResult<Next> + Send + Sync + 'static,
Sourcepub fn stateful_map_result<State, Next, F>(
self,
seed: State,
f: F,
) -> Source<Next, Mat>where
State: Clone + Send + Sync + 'static,
Next: Send + 'static,
F: Fn(&mut State, Out) -> StreamResult<Next> + Send + Sync + 'static,
👎Deprecated since 0.9.0: renamed to try_stateful_map (idiomatic); the _result name still works
pub fn stateful_map_result<State, Next, F>(
self,
seed: State,
f: F,
) -> Source<Next, Mat>where
State: Clone + Send + Sync + 'static,
Next: Send + 'static,
F: Fn(&mut State, Out) -> StreamResult<Next> + Send + Sync + 'static,
renamed to try_stateful_map (idiomatic); the _result name still works
Deprecated alias for Source::try_stateful_map.
pub fn stateful_map_result_with_supervision<State, Next, F>(
self,
seed: State,
f: F,
decider: SupervisionDecider,
) -> Source<Next, Mat>where
State: Clone + Send + Sync + 'static,
Next: Send + 'static,
F: Fn(&mut State, Out) -> StreamResult<Next> + Send + Sync + 'static,
pub fn stateful_map_concat<State, Next, F, I>( self, seed: State, f: F, ) -> Source<Next, Mat>
pub fn try_stateful_map_concat<State, Next, F, I>(
self,
seed: State,
f: F,
) -> Source<Next, Mat>where
State: Clone + Send + Sync + 'static,
Next: Send + 'static,
F: Fn(&mut State, Out) -> StreamResult<I> + Send + Sync + 'static,
I: IntoIterator<Item = Next>,
I::IntoIter: Send + 'static,
Sourcepub fn stateful_map_concat_result<State, Next, F, I>(
self,
seed: State,
f: F,
) -> Source<Next, Mat>where
State: Clone + Send + Sync + 'static,
Next: Send + 'static,
F: Fn(&mut State, Out) -> StreamResult<I> + Send + Sync + 'static,
I: IntoIterator<Item = Next>,
I::IntoIter: Send + 'static,
👎Deprecated since 0.9.0: renamed to try_stateful_map_concat (idiomatic); the _result name still works
pub fn stateful_map_concat_result<State, Next, F, I>(
self,
seed: State,
f: F,
) -> Source<Next, Mat>where
State: Clone + Send + Sync + 'static,
Next: Send + 'static,
F: Fn(&mut State, Out) -> StreamResult<I> + Send + Sync + 'static,
I: IntoIterator<Item = Next>,
I::IntoIter: Send + 'static,
renamed to try_stateful_map_concat (idiomatic); the _result name still works
Deprecated alias for Source::try_stateful_map_concat.
pub fn stateful_map_concat_result_with_supervision<State, Next, F, I>(
self,
seed: State,
f: F,
decider: SupervisionDecider,
) -> Source<Next, Mat>where
State: Clone + Send + Sync + 'static,
Next: Send + 'static,
F: Fn(&mut State, Out) -> StreamResult<I> + Send + Sync + 'static,
I: IntoIterator<Item = Next>,
I::IntoIter: Send + 'static,
pub fn map_async<Next, F, Fut>( self, parallelism: usize, f: F, ) -> Source<Next, Mat>
pub fn map_async_with_supervision<Next, F, Fut>( self, parallelism: usize, f: F, decider: SupervisionDecider, ) -> Source<Next, Mat>
pub fn map_async_unordered<Next, F, Fut>( self, parallelism: usize, f: F, ) -> Source<Next, Mat>
pub fn map_async_unordered_with_supervision<Next, F, Fut>( self, parallelism: usize, f: F, decider: SupervisionDecider, ) -> Source<Next, Mat>
pub fn map_async_partitioned<Key, Next, Partition, F, Fut>( self, parallelism: usize, per_partition: usize, partition: Partition, f: F, ) -> Source<Next, Mat>
pub fn prefix_and_tail(self, n: usize) -> Source<(Vec<Out>, Source<Out>), Mat>
pub fn flat_map_prefix<Next, FlowMat, F>( self, n: usize, f: F, ) -> Source<Next, Mat>
pub fn group_by<Key, F>( self, max_substreams: usize, f: F, allow_closed_substream_recreation: bool, ) -> Source<Source<Out>, Mat>
pub fn split_when<F>(self, predicate: F) -> Source<Source<Out>, Mat>
pub fn split_after<F>(self, predicate: F) -> Source<Source<Out>, Mat>
pub fn flat_map_concat<Next, NextMat, F>(self, f: F) -> Source<Next, Mat>
pub fn flat_map_merge<Next, NextMat, F>( self, breadth: usize, f: F, ) -> Source<Next, Mat>
pub fn take(self, n: usize) -> Source<Out, Mat>
pub fn drop(self, n: usize) -> Source<Out, Mat>
pub fn take_while<F>(self, predicate: F) -> Source<Out, Mat>
pub fn drop_while<F>(self, predicate: F) -> Source<Out, Mat>
pub fn limit(self, max: u64) -> Source<Out, Mat>
pub fn grouped(self, size: usize) -> Source<Vec<Out>, Mat>
pub fn scan<State, F>(self, seed: State, f: F) -> Source<State, Mat>
pub fn scan_async<State, F, Fut>(self, seed: State, f: F) -> Source<State, Mat>
pub fn try_scan<State, F>(self, seed: State, f: F) -> Source<State, Mat>
Sourcepub fn scan_result<State, F>(self, seed: State, f: F) -> Source<State, Mat>
👎Deprecated since 0.9.0: renamed to try_scan (idiomatic); the _result name still works
pub fn scan_result<State, F>(self, seed: State, f: F) -> Source<State, Mat>
renamed to try_scan (idiomatic); the _result name still works
Deprecated alias for Source::try_scan.
pub fn scan_result_with_supervision<State, F>( self, seed: State, f: F, decider: SupervisionDecider, ) -> Source<State, Mat>
pub fn sliding(self, size: usize, step: usize) -> Source<Vec<Out>, Mat>where
Out: Clone,
pub fn fold<Acc, F>(self, zero: Acc, f: F) -> Source<Acc, Mat>
pub fn fold_async<Acc, F, Fut>(self, zero: Acc, f: F) -> Source<Acc, Mat>
pub fn map_with_resource<Resource, Next, Create, F, Close>(
self,
create: Create,
f: F,
close: Close,
) -> Source<Next, Mat>where
Resource: Send + 'static,
Next: Send + 'static,
Create: Fn() -> StreamResult<Resource> + Send + Sync + 'static,
F: Fn(&mut Resource, Out) -> StreamResult<Next> + Send + Sync + 'static,
Close: Fn(Resource) -> StreamResult<Option<Next>> + Send + Sync + 'static,
pub fn try_fold<Acc, F>(self, zero: Acc, f: F) -> Source<Acc, Mat>
Sourcepub fn fold_result<Acc, F>(self, zero: Acc, f: F) -> Source<Acc, Mat>
👎Deprecated since 0.9.0: renamed to try_fold (idiomatic); the _result name still works
pub fn fold_result<Acc, F>(self, zero: Acc, f: F) -> Source<Acc, Mat>
renamed to try_fold (idiomatic); the _result name still works
Deprecated alias for Source::try_fold.
pub fn fold_result_with_supervision<Acc, F>( self, zero: Acc, f: F, decider: SupervisionDecider, ) -> Source<Acc, Mat>
pub fn reduce<F>(self, f: F) -> Source<Out, Mat>
pub fn try_reduce<F>(self, f: F) -> Source<Out, Mat>
Sourcepub fn reduce_result<F>(self, f: F) -> Source<Out, Mat>
👎Deprecated since 0.9.0: renamed to try_reduce (idiomatic); the _result name still works
pub fn reduce_result<F>(self, f: F) -> Source<Out, Mat>
renamed to try_reduce (idiomatic); the _result name still works
Deprecated alias for Source::try_reduce.