truefix_core/cracker.rs
1//! Typed message dispatch contract.
2//!
3//! The concrete, generated dispatch mechanism lives in `truefix-dict` (feature 002/US6,
4//! FR-020/022): each targeted version generates a `<Version>MessageHandler` trait (one method per
5//! message type, default no-op) and a `crack_<version>(message, &mut handler) -> bool` function
6//! that routes an inbound [`Message`] to the matching method by `(BeginString, MsgType)` — e.g.
7//! `truefix_dict::fix44::crack_fix44`. This trait is a version-agnostic marker for integrators who
8//! want a single type across versions; implement it by delegating to the generated `crack_*`
9//! function(s) for the versions you support.
10
11use crate::message::Message;
12
13/// A version-agnostic marker for a type that dispatches inbound messages to typed handlers.
14///
15/// Implementors typically delegate to one or more generated `crack_<version>` functions from
16/// `truefix-dict` (see the module docs above).
17pub trait MessageCracker {
18 /// Attempt to dispatch `message` to a typed handler. Returns whether a handler matched.
19 fn crack(&mut self, message: &Message) -> bool;
20}