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§
Sourcefn set_state(&mut self, state: NodeState) -> GraphResult<()>
fn set_state(&mut self, state: NodeState) -> GraphResult<()>
Set the node state.
Sourcefn outputs(&self) -> &[OutputPort]
fn outputs(&self) -> &[OutputPort]
Get the node’s output ports.
Sourcefn process(
&mut self,
input: Option<FilterFrame>,
) -> GraphResult<Option<FilterFrame>>
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§
Sourcefn initialize(&mut self) -> GraphResult<()>
fn initialize(&mut self) -> GraphResult<()>
Initialize the node before processing starts.
Sourcefn flush(&mut self) -> GraphResult<Vec<FilterFrame>>
fn flush(&mut self) -> GraphResult<Vec<FilterFrame>>
Flush any buffered data.
Sourcefn reset(&mut self) -> GraphResult<()>
fn reset(&mut self) -> GraphResult<()>
Reset the node to initial state.
Sourcefn input_port(&self, id: PortId) -> Option<&InputPort>
fn input_port(&self, id: PortId) -> Option<&InputPort>
Get input port by ID.
Sourcefn output_port(&self, id: PortId) -> Option<&OutputPort>
fn output_port(&self, id: PortId) -> Option<&OutputPort>
Get output port by ID.
Sourcefn accepts_input(&self, port_type: PortType) -> bool
fn accepts_input(&self, port_type: PortType) -> bool
Check if node accepts the given port type as input.
Sourcefn produces_output(&self, port_type: PortType) -> bool
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".