Skip to main content

ChainBuilder

Struct ChainBuilder 

Source
pub struct ChainBuilder<DF: RecFamily, CurF: RecFamily, D, P> { /* private fields */ }
Expand description

Fluent builder for one pipeline’s operator chain. DF is the deserializer’s record family; CurF the family at the current end of the chain (changed by map_rec and flat_map, and by map for owned payloads).

Implementations§

Source§

impl<DF: RecFamily, CurF: RecFamily, D, P> ChainBuilder<DF, CurF, D, P>

Source

pub fn with_metrics( self, pipeline: impl Into<String>, component: impl Into<String>, ) -> Self

Enable framework metrics for every stage of this chain. Must be called before any stage is added so all stages get handles.

§Panics

Panics if stages were already added.

Source

pub fn deser_error_policy(self, policy: ErrorPolicy) -> Self

Error policy for the deserializer stage (default: Skip).

Source

pub fn map_rec<NF, G>(self, f: G) -> ChainBuilder<DF, NF, D, MapPart<P, G>>
where NF: RecFamily, G: for<'buf> MapFn<CurF::Rec<'buf>, NF::Rec<'buf>>,

Transform each record into family NF. For borrowing families pass a fn item (see the module docs); for owned payloads ChainBuilder::map is more ergonomic.

Source

pub fn try_map_rec<NF, G, E>( self, f: G, policy: ErrorPolicy, ) -> ChainBuilder<DF, NF, D, TryMapPart<P, G>>
where NF: RecFamily, G: for<'buf> TryMapFn<CurF::Rec<'buf>, NF::Rec<'buf>, E>, E: Display,

Fallibly transform each record into family NF with a per-stage ErrorPolicy. For borrowing families pass a fn item.

Source

pub fn filter<Pr>(self, p: Pr) -> ChainBuilder<DF, CurF, D, FilterPart<P, Pr>>
where Pr: for<'buf> FnMut(&CurF::Rec<'buf>) -> bool,

Keep only records whose payload satisfies the predicate.

Source

pub fn inspect<G>(self, f: G) -> ChainBuilder<DF, CurF, D, InspectPart<P, G>>
where G: for<'buf> FnMut(&CurF::Rec<'buf>),

Observe each record’s payload without transforming it.

Source

pub fn flat_map<OutF, G>( self, g: G, ) -> ChainBuilder<DF, OutF, D, FlatMapPart<OutF, P, G>>
where OutF: RecFamily, G: for<'buf> FnMut(CurF::Rec<'buf>, &mut Emitter<'_, OutF>),

Expand each record into 0..N records of family OutF through a stack-borrowed Emitter.

Source

pub fn sink<E, R>( self, encoder: E, router: R, cfg: ChunkConfig, queues: ShardQueues, budget: Arc<InflightBudget>, ) -> SinkedChain<DF, CurF, D, P, E, R>

Terminate the chain into a sink: records are routed by router, encoded by encoder on the pipeline thread, and handed to the sink workers through queues.

Source§

impl<DF: RecFamily, T: Send + 'static, D, P> ChainBuilder<DF, Owned<T>, D, P>

Closure-friendly transforms for chains whose current records are owned.

Source

pub fn map<U, G>(self, f: G) -> ChainBuilder<DF, Owned<U>, D, MapPart<P, G>>
where U: Send + 'static, G: FnMut(T) -> U,

Transform each record’s payload. Bare closures infer; the output type may differ (the chain’s family becomes Owned<U>).

Source

pub fn try_map<U, G, E>( self, f: G, policy: ErrorPolicy, ) -> ChainBuilder<DF, Owned<U>, D, TryMapPart<P, G>>
where U: Send + 'static, G: FnMut(T) -> Result<U, E>, E: Display,

Fallibly transform each record’s payload with a per-stage ErrorPolicy.

Trait Implementations§

Source§

impl<DF: Clone + RecFamily, CurF: Clone + RecFamily, D: Clone, P: Clone> Clone for ChainBuilder<DF, CurF, D, P>

Source§

fn clone(&self) -> ChainBuilder<DF, CurF, D, P>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<DF: Debug + RecFamily, CurF: Debug + RecFamily, D: Debug, P: Debug> Debug for ChainBuilder<DF, CurF, D, P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<DF, CurF, D, P> Freeze for ChainBuilder<DF, CurF, D, P>
where D: Freeze, P: Freeze,

§

impl<DF, CurF, D, P> !RefUnwindSafe for ChainBuilder<DF, CurF, D, P>

§

impl<DF, CurF, D, P> Send for ChainBuilder<DF, CurF, D, P>
where D: Send, P: Send,

§

impl<DF, CurF, D, P> Sync for ChainBuilder<DF, CurF, D, P>
where D: Sync, P: Sync,

§

impl<DF, CurF, D, P> Unpin for ChainBuilder<DF, CurF, D, P>
where D: Unpin, P: Unpin,

§

impl<DF, CurF, D, P> UnsafeUnpin for ChainBuilder<DF, CurF, D, P>
where D: UnsafeUnpin, P: UnsafeUnpin,

§

impl<DF, CurF, D, P> !UnwindSafe for ChainBuilder<DF, CurF, D, P>

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,