Skip to main content

EdgeWeightFromSimAndDerived

Trait EdgeWeightFromSimAndDerived 

Source
pub trait EdgeWeightFromSimAndDerived: Sized {
    // Required method
    fn from_sim_and_derived(
        sim: &dyn ProtocolSim,
        component_id: &ComponentId,
        token_in: &Token,
        token_out: &Token,
        derived: &DerivedData,
    ) -> Option<Self>;
}
Expand description

Trait for edge weight types that can be computed from a ProtocolSim and DerivedData.

Implement this trait for edge data types that should use pre-computed derived data (pool depths, spot prices, etc.) instead of computing them from scratch.

Required Methods§

Source

fn from_sim_and_derived( sim: &dyn ProtocolSim, component_id: &ComponentId, token_in: &Token, token_out: &Token, derived: &DerivedData, ) -> Option<Self>

Computes edge weight data using ProtocolSim and pre-computed DerivedData.

§Arguments
  • sim - The protocol simulation state
  • component_id - The component ID for derived data lookup
  • token_in - The input token
  • token_out - The output token
  • derived - Pre-computed derived data (pool depths, spot prices, etc.)
§Returns

The computed edge weight, or None if it cannot be computed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl EdgeWeightFromSimAndDerived for ()

Trivial implementation for algorithms that don’t use edge weights (e.g., Bellman-Ford).

Source§

fn from_sim_and_derived( _sim: &dyn ProtocolSim, _component_id: &ComponentId, _token_in: &Token, _token_out: &Token, _derived: &DerivedData, ) -> Option<Self>

Implementors§