Skip to main content

Node

Trait Node 

Source
pub trait Node: Send + Sync {
Show 15 methods // Required methods fn id(&self) -> NodeId; fn name(&self) -> &str; fn node_type(&self) -> NodeType; fn state(&self) -> NodeState; fn set_state(&mut self, state: NodeState) -> GraphResult<()>; fn inputs(&self) -> &[InputPort]; fn outputs(&self) -> &[OutputPort]; fn process( &mut self, input: Option<FilterFrame>, ) -> GraphResult<Option<FilterFrame>>; // Provided methods fn initialize(&mut self) -> GraphResult<()> { ... } fn flush(&mut self) -> GraphResult<Vec<FilterFrame>> { ... } fn reset(&mut self) -> GraphResult<()> { ... } fn input_port(&self, id: PortId) -> Option<&InputPort> { ... } fn output_port(&self, id: PortId) -> Option<&OutputPort> { ... } fn accepts_input(&self, port_type: PortType) -> bool { ... } fn produces_output(&self, port_type: PortType) -> bool { ... }
}
Expand description

Trait for filter graph nodes.

Nodes implement this trait to participate in the filter graph. The graph will call Node::process to push frames through the pipeline.

Required Methods§

Source

fn id(&self) -> NodeId

Get the node’s unique identifier.

Source

fn name(&self) -> &str

Get the node’s name.

Source

fn node_type(&self) -> NodeType

Get the node type.

Source

fn state(&self) -> NodeState

Get the current state of the node.

Source

fn set_state(&mut self, state: NodeState) -> GraphResult<()>

Set the node state.

Source

fn inputs(&self) -> &[InputPort]

Get the node’s input ports.

Source

fn outputs(&self) -> &[OutputPort]

Get the node’s output ports.

Source

fn process( &mut self, input: Option<FilterFrame>, ) -> GraphResult<Option<FilterFrame>>

Process available input and produce output.

Returns Ok(Some(frame)) if a frame was produced, Ok(None) if no frame is ready (need more input), or Err on error.

Provided Methods§

Source

fn initialize(&mut self) -> GraphResult<()>

Initialize the node before processing starts.

Source

fn flush(&mut self) -> GraphResult<Vec<FilterFrame>>

Flush any buffered data.

Source

fn reset(&mut self) -> GraphResult<()>

Reset the node to initial state.

Source

fn input_port(&self, id: PortId) -> Option<&InputPort>

Get input port by ID.

Source

fn output_port(&self, id: PortId) -> Option<&OutputPort>

Get output port by ID.

Source

fn accepts_input(&self, port_type: PortType) -> bool

Check if node accepts the given port type as input.

Source

fn produces_output(&self, port_type: PortType) -> bool

Check if node produces the given port type as output.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§