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§
Sourcefn from_sim_and_derived(
sim: &dyn ProtocolSim,
component_id: &ComponentId,
token_in: &Token,
token_out: &Token,
derived: &DerivedData,
) -> Option<Self>
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 statecomponent_id- The component ID for derived data lookuptoken_in- The input tokentoken_out- The output tokenderived- 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).
impl EdgeWeightFromSimAndDerived for ()
Trivial implementation for algorithms that don’t use edge weights (e.g., Bellman-Ford).