Skip to main content

Source

Struct Source 

Source
pub struct Source<T> { /* private fields */ }

Implementations§

Source§

impl<T: Send + 'static> Source<T>

Source

pub fn from_iter<I: IntoIterator<Item = T> + Send + 'static>(iter: I) -> Self
where I::IntoIter: Send + 'static,

Source

pub fn single(value: T) -> Self

Source

pub fn empty() -> Self

Source

pub fn repeat(value: T) -> Self
where T: Clone,

Source

pub fn cycle<I: IntoIterator<Item = T> + Clone + Send + 'static>( iter: I, ) -> Self
where I::IntoIter: Send + 'static, T: Clone,

Source

pub fn from_future<F>(fut: F) -> Self
where F: Future<Output = T> + Send + 'static,

Source

pub fn unfold<S, F, Fut>(init: S, f: F) -> Self
where S: Send + 'static, F: FnMut(S) -> Fut + Send + 'static, Fut: Future<Output = Option<(T, S)>> + Send + 'static,

Source

pub fn tick(initial_delay: Duration, interval: Duration, value: T) -> Self
where T: Clone,

Source

pub fn failed<E>(error: E) -> Source<Result<T, E>>
where E: Send + 'static,

Source

pub fn from_receiver(rx: UnboundedReceiver<T>) -> Self

Source

pub fn map<U, F>(self, f: F) -> Source<U>
where F: FnMut(T) -> U + Send + 'static, U: Send + 'static,

Source

pub fn map_async<U, F, Fut>(self, parallelism: usize, f: F) -> Source<U>
where F: FnMut(T) -> Fut + Send + 'static, Fut: Future<Output = U> + Send + 'static, U: Send + 'static,

(ordered, bounded parallelism).

Source

pub fn map_async_unordered<U, F, Fut>( self, parallelism: usize, f: F, ) -> Source<U>
where F: FnMut(T) -> Fut + Send + 'static, Fut: Future<Output = U> + Send + 'static, U: Send + 'static,

Source

pub fn async_boundary(self, buffer: usize) -> Source<T>

async_boundary(buffer) — explicit async stage that decouples the upstream and downstream pipelines onto separate Tokio tasks via a bounded mpsc channel of capacity buffer. the .async call. Phase 12.3 of docs/full-port-plan.md.

Useful when an upstream stage is CPU-heavy and you want downstream consumption to overlap with production. Slow downstream applies natural back-pressure once the buffer fills.

Source

pub fn filter<F>(self, f: F) -> Source<T>
where F: FnMut(&T) -> bool + Send + 'static,

Source

pub fn filter_map<U, F>(self, f: F) -> Source<U>
where F: FnMut(T) -> Option<U> + Send + 'static, U: Send + 'static,

Source

pub fn take(self, n: usize) -> Source<T>

Source

pub fn take_while<F>(self, f: F) -> Source<T>
where F: FnMut(&T) -> bool + Send + 'static,

Source

pub fn skip(self, n: usize) -> Source<T>

Source

pub fn skip_while<F>(self, f: F) -> Source<T>
where F: FnMut(&T) -> bool + Send + 'static,

Source

pub fn scan<Acc, F>(self, init: Acc, f: F) -> Source<Acc>
where Acc: Clone + Send + 'static, F: FnMut(&Acc, T) -> Acc + Send + 'static,

Source

pub fn grouped(self, n: usize) -> Source<Vec<T>>

Emit vectors of up to n items.

Source

pub fn intersperse(self, sep: T) -> Source<T>
where T: Clone,

Source

pub fn concat(self, other: Source<T>) -> Source<T>

Source

pub fn prepend(self, other: Source<T>) -> Source<T>

Source

pub fn delay(self, d: Duration) -> Source<T>

Shift every element by d.

Source

pub fn initial_delay(self, d: Duration) -> Source<T>

Wait d before emitting the first element.

Source

pub fn throttle(self, interval: Duration) -> Source<T>

Limit element rate (one per interval).

Source

pub fn buffer(self, size: usize, strategy: OverflowStrategy) -> Source<T>

Source

pub fn wire_tap<F>(self, f: F) -> Source<T>
where F: FnMut(&T) + Send + 'static,

Observes each element without affecting the stream.

Source

pub fn via<U>(self, flow: Flow<T, U>) -> Source<U>
where U: Send + 'static,

Auto Trait Implementations§

§

impl<T> Freeze for Source<T>

§

impl<T> !RefUnwindSafe for Source<T>

§

impl<T> Send for Source<T>

§

impl<T> !Sync for Source<T>

§

impl<T> Unpin for Source<T>

§

impl<T> UnsafeUnpin for Source<T>

§

impl<T> !UnwindSafe for Source<T>

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> 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, 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.