pub trait DynamicInstrument: Route { }Expand description
An instrument type every venue DynamicStreams routes to can subscribe with.
Implemented for MarketDataInstrument,
Keyed over it, and
MarketInstrumentData: the representations every
connector can name a market for. It stands for the whole set of per-connector identifier
bounds, so a caller generic over the instrument states this one bound rather than one per
connector and kind.
Which connectors it covers depends on the cargo features enabled: with alpaca it also
requires AlpacaInstrument, with lse LseInstrument, with massive
MassiveInstrument, with hyperliquid HyperliquidInstrument. The three types above
satisfy every combination.
§Only this crate’s instrument types implement it
It is sealed: its supertrait lives in a private module, so no crate but this one can name it
or implement it. This crate implements that supertrait once, as a blanket impl requiring an
Identifier<ExchangeMarket> impl for a Subscription over the type, per connector and kind.
A downstream crate cannot write those impls for a type of its own either: the coherence rules
leave them to the crate that owns Identifier, Subscription and the market types, which is
this one. So the set of qualifying types is exactly the three above, in every build, whichever
features any crate in the build enables. A custom instrument type streams through the typed
Streams builder instead, for a connector whose identifier it can
provide: LseInstrument is implementable for a downstream type, for example.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".