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§
fn name(&self) -> &str
fn allocate_shape(&self, allocator: &mut PortAllocator) -> Self::Shape
fn stage_spec(&self, shape: &Self::Shape) -> StageSpec
Provided Methods§
Sourcefn stage_spec_with_ports(
&self,
shape: &Self::Shape,
_inlets: Vec<AnyInlet>,
_outlets: Vec<AnyOutlet>,
) -> StageSpec
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.
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".