pub struct TopicRegistry { /* private fields */ }Expand description
Maps (StreamKind, AccountType) → (TopicPattern, ParserFn).
Also maintains a flat dispatch list of (TopicPattern, ParserFn) for O(patterns) per-frame dispatch (typically 5-40 patterns per exchange).
Immutable after construction — built once via TopicRegistryBuilder.
Implementations§
Source§impl TopicRegistry
impl TopicRegistry
pub fn builder() -> TopicRegistryBuilder
Sourcepub fn dispatch(&self, key: &TopicKey) -> Option<ParserFn>
pub fn dispatch(&self, key: &TopicKey) -> Option<ParserFn>
Look up a parser for an incoming frame’s topic key. Returns the first pattern that matches. O(patterns).
Sourcepub fn dispatch_all(&self, key: &TopicKey) -> Vec<ParserFn> ⓘ
pub fn dispatch_all(&self, key: &TopicKey) -> Vec<ParserFn> ⓘ
Look up ALL parsers whose pattern matches the topic key.
Used when multiple StreamKind entries share the same wire topic
(e.g. Bybit linear tickers.* carries Ticker + MarkPrice + FundingRate + OpenInterest).
Returns parsers in registration order (de-duplicated by pointer identity).
Sourcepub fn supports(&self, kind: &StreamKind, account: AccountType) -> bool
pub fn supports(&self, kind: &StreamKind, account: AccountType) -> bool
Returns true if (kind, account) has a registered parser.
Sourcepub fn native_pairs(
&self,
) -> impl Iterator<Item = (&StreamKind, AccountType)> + '_
pub fn native_pairs( &self, ) -> impl Iterator<Item = (&StreamKind, AccountType)> + '_
Returns all (kind, account) pairs with Native support.
Sourcepub fn entries(&self) -> &HashMap<RegistryKey, RegistryEntry>
pub fn entries(&self) -> &HashMap<RegistryKey, RegistryEntry>
Returns a reference to all raw entries (for capability introspection).