pub struct Source<Out, Mat = NotUsed> { /* private fields */ }Implementations§
Source§impl<T: Send + 'static> Source<T, NotUsed>
impl<T: Send + 'static> Source<T, NotUsed>
pub fn queue_bounded(capacity: usize) -> Source<T, BoundedSourceQueue<T>>
pub fn queue( capacity: usize, strategy: OverflowStrategy, ) -> Source<T, SourceQueue<T>>
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 map_result<Next, F>(self, f: F) -> Source<Next, Mat>
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 filter_result<F>(self, predicate: F) -> Source<Out, Mat>
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 filter_map_result<Next, F>(self, f: F) -> Source<Next, Mat>
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 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,
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 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,
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 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,
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 scan_result<State, F>(self, seed: State, f: F) -> Source<State, Mat>
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 fold_result<Acc, F>(self, zero: Acc, f: F) -> Source<Acc, Mat>
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 reduce_result<F>(self, f: F) -> Source<Out, Mat>
pub fn reduce_result_with_supervision<F>( self, f: F, decider: SupervisionDecider, ) -> Source<Out, Mat>
pub fn map_error<F>(self, f: F) -> Source<Out, Mat>
pub fn recover<F>(self, f: F) -> Source<Out, Mat>
pub fn recover_with<F>(self, f: F) -> Source<Out, Mat>
pub fn recover_with_retries<F>(self, retries: usize, f: F) -> Source<Out, Mat>
pub fn on_error_complete(self) -> Source<Out, Mat>
pub fn concat<Mat2>(self, that: Source<Out, Mat2>) -> Source<Out, Mat>where
Mat2: Send + 'static,
pub fn concat_lazy<Mat2>(self, that: Source<Out, Mat2>) -> Source<Out, Mat>where
Mat2: Send + 'static,
pub fn concat_all_lazy<Mat2, I>(self, those: I) -> Source<Out, Mat>
pub fn prepend<Mat2>(self, that: Source<Out, Mat2>) -> Source<Out, Mat>where
Mat2: Send + 'static,
pub fn prepend_lazy<Mat2>(self, that: Source<Out, Mat2>) -> Source<Out, Mat>where
Mat2: Send + 'static,
pub fn or_else<Mat2>(self, secondary: Source<Out, Mat2>) -> Source<Out, Mat>where
Mat2: Send + 'static,
pub fn interleave<Mat2>(
self,
that: Source<Out, Mat2>,
segment_size: usize,
) -> Source<Out, Mat>where
Mat2: Send + 'static,
pub fn interleave_all<Mat2, I>( self, those: I, segment_size: usize, eager_close: bool, ) -> Source<Out, Mat>
pub fn merge_sorted<Mat2>(self, that: Source<Out, Mat2>) -> Source<Out, Mat>
pub fn merge_latest<Mat2>( self, that: Source<Out, Mat2>, eager_complete: bool, ) -> Source<Vec<Out>, Mat>
pub fn merge_all<Mat2, I>( self, those: I, eager_complete: bool, ) -> Source<Out, Mat>
pub fn zip_with<Mat2, Out2, Next, F>( self, that: Source<Out2, Mat2>, combine: F, ) -> Source<Next, Mat>
pub fn zip_latest<Mat2, Out2>( self, that: Source<Out2, Mat2>, ) -> Source<(Out, Out2), Mat>
pub fn zip_latest_with<Mat2, Out2, Next, F>( self, that: Source<Out2, Mat2>, eager_complete: bool, combine: F, ) -> Source<Next, Mat>
pub fn zip_with_index(self) -> Source<(Out, u64), Mat>
pub fn zip_all<Mat2, Out2>( self, that: Source<Out2, Mat2>, this_elem: Out, that_elem: Out2, ) -> Source<(Out, Out2), Mat>
pub fn also_to<SinkMat>(self, sink: Sink<Out, SinkMat>) -> Source<Out, Mat>
pub fn also_to_all<SinkMat, I>(self, sinks: I) -> Source<Out, Mat>
pub fn divert_to<SinkMat, F>( self, sink: Sink<Out, SinkMat>, predicate: F, ) -> Source<Out, Mat>
pub fn wire_tap<SinkMat>(self, sink: Sink<Out, SinkMat>) -> Source<Out, Mat>
pub fn run_with<SinkMat: Send + 'static>( self, sink: Sink<Out, SinkMat>, ) -> StreamResult<SinkMat>
pub fn run_with_materializer<SinkMat: Send + 'static>( self, sink: Sink<Out, SinkMat>, materializer: &Materializer, ) -> StreamResult<SinkMat>
pub fn to<SinkMat>(self, sink: Sink<Out, SinkMat>) -> RunnableGraph<Mat>where
SinkMat: Send + 'static,
pub fn to_mat<SinkMat, Combined, F>( self, sink: Sink<Out, SinkMat>, combine: F, ) -> RunnableGraph<Combined>
pub fn run_collect(self) -> StreamResult<Vec<Out>>
pub fn map_materialized_value<NextMat, F>(self, f: F) -> Source<Out, NextMat>
Source§impl<Out: Clone + Send + Sync + 'static> Source<Out, NotUsed>
impl<Out: Clone + Send + Sync + 'static> Source<Out, NotUsed>
pub fn combine<Mat1, Mat2, MatRest, I>(
first: Source<Out, Mat1>,
second: Source<Out, Mat2>,
rest: I,
strategy: SourceCombineStrategy,
) -> Source<Out, NotUsed>where
Mat1: Send + 'static,
Mat2: Send + 'static,
MatRest: Send + 'static,
I: IntoIterator<Item = Source<Out, MatRest>>,
pub fn zip_n<Mat2, I>(sources: I) -> Source<Vec<Out>, NotUsed>
pub fn zip_with_n<Mat2, I, Next, F>( sources: I, zipper: F, ) -> Source<Next, NotUsed>
pub fn merge_prioritized_n<Mat2, I>( sources_and_priorities: I, eager_complete: bool, ) -> Source<Out, NotUsed>
pub fn maybe() -> (MaybeHandle<Out>, Self)
pub fn single(item: Out) -> Self
pub fn repeat(item: Out) -> Self
pub fn from_iterable<I>(items: I) -> Selfwhere
I: IntoIterator<Item = Out>,
Source§impl<Out: Send + 'static, Mat: Send + 'static> Source<Out, Mat>
impl<Out: Send + 'static, Mat: Send + 'static> Source<Out, Mat>
pub fn throttle( self, elements: u64, per: Duration, maximum_burst: i32, mode: ThrottleMode, ) -> Self
pub fn throttle_with_cost<CostFn>( self, cost: u64, per: Duration, maximum_burst: i32, cost_fn: CostFn, mode: ThrottleMode, ) -> Self
pub fn delay(self, delay: Duration, strategy: DelayOverflowStrategy) -> Self
pub fn delay_with<Supplier, Strategy>( self, delay_strategy_supplier: Supplier, overflow_strategy: DelayOverflowStrategy, ) -> Self
pub fn initial_delay(self, delay: Duration) -> Self
pub fn grouped_within( self, max_number: usize, interval: Duration, ) -> Source<Vec<Out>, Mat>
pub fn grouped_weighted_within<CostFn>( self, max_weight: u64, interval: Duration, cost_fn: CostFn, ) -> Source<Vec<Out>, Mat>
pub fn drop_within(self, timeout: Duration) -> Self
pub fn take_within(self, timeout: Duration) -> Self
pub fn idle_timeout(self, timeout: Duration) -> Self
pub fn backpressure_timeout(self, timeout: Duration) -> Self
pub fn completion_timeout(self, timeout: Duration) -> Self
pub fn initial_timeout(self, timeout: Duration) -> Self
pub fn keep_alive<Inject>(self, timeout: Duration, inject: Inject) -> Self
Trait Implementations§
Auto Trait Implementations§
impl<Out, Mat = NotUsed> !RefUnwindSafe for Source<Out, Mat>
impl<Out, Mat = NotUsed> !UnwindSafe for Source<Out, Mat>
impl<Out, Mat> Freeze for Source<Out, Mat>
impl<Out, Mat> Send for Source<Out, Mat>
impl<Out, Mat> Sync for Source<Out, Mat>
impl<Out, Mat> Unpin for Source<Out, Mat>
impl<Out, Mat> UnsafeUnpin for Source<Out, Mat>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage