pub trait Subscriber:
Clone
+ Send
+ Sync {
type SubMapper: SubscriptionMapper;
// Required method
fn subscribe<Exchange, Instrument, Kind>(
&self,
subscriptions: &[Subscription<Exchange, Instrument, Kind>],
) -> impl Future<Output = Result<Subscribed<Instrument::Key>, SocketError>> + Send
where Exchange: Connector + Send + Sync,
Kind: SubscriptionKind + Send + Sync,
Instrument: InstrumentData,
Subscription<Exchange, Instrument, Kind>: Identifier<Exchange::Channel> + Identifier<Exchange::Market>;
}Expand description
Defines how to connect to a socket and subscribe to market data streams.
Subscribers may carry state such as authentication credentials.
The trait requires Clone to support reconnection (subscribers are cloned
into the reconnect closure).
Required Associated Types§
Required Methods§
fn subscribe<Exchange, Instrument, Kind>(
&self,
subscriptions: &[Subscription<Exchange, Instrument, Kind>],
) -> impl Future<Output = Result<Subscribed<Instrument::Key>, SocketError>> + Sendwhere
Exchange: Connector + Send + Sync,
Kind: SubscriptionKind + Send + Sync,
Instrument: InstrumentData,
Subscription<Exchange, Instrument, Kind>: Identifier<Exchange::Channel> + Identifier<Exchange::Market>,
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.