Skip to main content

GraphStage

Trait GraphStage 

Source
pub trait GraphStage:
    Send
    + Sync
    + 'static {
    type Shape: Shape;

    // Required methods
    fn name(&self) -> &str;
    fn allocate_shape(&self, allocator: &mut PortAllocator) -> Self::Shape;
    fn stage_spec(&self, shape: &Self::Shape) -> StageSpec;

    // Provided methods
    fn stage_spec_with_ports(
        &self,
        shape: &Self::Shape,
        _inlets: Vec<AnyInlet>,
        _outlets: Vec<AnyOutlet>,
    ) -> StageSpec { ... }
    fn create_logic(&self, shape: &Self::Shape) -> GraphStageLogic { ... }
}

Required Associated Types§

Required Methods§

Source

fn name(&self) -> &str

Source

fn allocate_shape(&self, allocator: &mut PortAllocator) -> Self::Shape

Source

fn stage_spec(&self, shape: &Self::Shape) -> StageSpec

Provided Methods§

Source

fn stage_spec_with_ports( &self, shape: &Self::Shape, _inlets: Vec<AnyInlet>, _outlets: Vec<AnyOutlet>, ) -> StageSpec

Builds the StageSpec for this stage, reusing the caller-provided port vectors to avoid re-cloning them from the shape.

Contract: callers MUST pass vectors that are equal to shape.inlets() and shape.outlets() respectively — this method assumes they already hold the correct ports for shape.

The default implementation ignores the provided vectors and falls back to stage_spec. Built-in stages override this method to accept the pre-cloned vectors directly and skip the redundant clone that stage_spec would otherwise perform.

Source

fn create_logic(&self, shape: &Self::Shape) -> GraphStageLogic

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<A, B> GraphStage for Unzip<A, B>
where A: Clone + Send + 'static, B: Clone + Send + 'static,

Source§

impl<In, Out0, Out1> GraphStage for UnzipWith<In, Out0, Out1>
where In: Clone + Send + 'static, Out0: Clone + Send + 'static, Out1: Clone + Send + 'static,

Source§

type Shape = FanOutShape2<In, Out0, Out1>

Source§

impl<In, Out> GraphStage for MapStage<In, Out>
where In: Clone + Send + 'static, Out: Clone + Send + 'static,

Source§

type Shape = FlowShape<In, Out>

Source§

impl<Left, Right> GraphStage for Zip<Left, Right>
where Left: Clone + Send + 'static, Right: Clone + Send + 'static,

Source§

type Shape = ZipShape<Left, Right>

Source§

impl<T> GraphStage for AsyncBoundary<T>
where T: Clone + Send + 'static,

Source§

impl<T> GraphStage for Balance<T>
where T: Clone + Send + 'static,

Source§

impl<T> GraphStage for Broadcast<T>
where T: Clone + Send + 'static,

Source§

impl<T> GraphStage for Buffer<T>
where T: Clone + Send + 'static,

Source§

impl<T> GraphStage for Concat<T>
where T: Clone + Send + 'static,

Source§

impl<T> GraphStage for Identity<T>
where T: Clone + Send + 'static,

Source§

impl<T> GraphStage for Interleave<T>
where T: Clone + Send + 'static,

Source§

impl<T> GraphStage for Merge<T>
where T: Clone + Send + 'static,

Source§

impl<T> GraphStage for MergeLatest<T>
where T: Clone + Send + 'static,

Source§

impl<T> GraphStage for MergePreferred<T>
where T: Clone + Send + 'static,

Source§

impl<T> GraphStage for MergePrioritized<T>
where T: Clone + Send + 'static,

Source§

impl<T> GraphStage for MergeSequence<T>
where T: Clone + Send + 'static,

Source§

impl<T> GraphStage for MergeSorted<T>
where T: Clone + Ord + Send + 'static,

Source§

impl<T> GraphStage for OrElse<T>
where T: Clone + Send + 'static,

Source§

impl<T> GraphStage for Partition<T>
where T: Clone + Send + 'static,

Source§

impl<T> GraphStage for TakeWhile<T>
where T: Clone + Send + 'static,