Skip to main content

MarketKey

Trait MarketKey 

Source
pub trait MarketKey:
    Clone
    + Eq
    + Hash
    + Debug
    + Send
    + Sync
    + 'static {
    type Value: Clone + Debug + Send + Sync + 'static;
}
Expand description

A typed address for one piece of market data.

Implementing this trait is the extension point of the whole design: the key names what is identified (symbol, currency, pair, …) and its associated Value fixes which type a lookup returns. Anyone — including downstream crates and tests — can add key types without touching Market.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
struct Correlation(String, String);
impl MarketKey for Correlation { type Value = CorrelationTermStructure; }

Required Associated Types§

Source

type Value: Clone + Debug + Send + Sync + 'static

The type a lookup with this key returns. Clone so a whole market can be cloned (the basis of scenario bumping: copy, then perturb).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§