Skip to main content

FormatElement

Trait FormatElement 

Source
pub trait FormatElement: ElementBound {
    // Required methods
    fn caps_constraint(&self) -> CapsConstraint<'_>;
    fn configure_link(
        &mut self,
        input: Option<&Caps>,
        output: Option<&Caps>,
    ) -> Result<(), G2gError>;

    // Provided method
    fn caps_preferences(&self) -> Option<CapsPreferences> { ... }
}
Expand description

Negotiation-time view of an element. The runtime side (AsyncElement::process) is unchanged; this trait carries the information the solver needs to assign caps to every link before process runs.

Required Methods§

Source

fn caps_constraint(&self) -> CapsConstraint<'_>

Declare the constraint this element imposes on its surrounding links. Read by the solver during negotiation.

Called by the runner once the solver has assigned caps to every link. Boundary elements (decoders, encoders) receive distinct input / output values; non-boundary elements receive equal ones. Sources see input = None; sinks see output = None.

Provided Methods§

Source

fn caps_preferences(&self) -> Option<CapsPreferences>

Optional per-alternative costs for this element’s advertised constraint. Defaults to None, meaning the solver uses the constraint’s own preference order (cost = alternative index).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§