Skip to main content

truefix_core/
factory.rs

1//! Message construction contract.
2//!
3//! The dictionary-backed, strongly-typed construction lives in `truefix-dict` (feature 002/US6):
4//! each targeted version generates a `<Message>::new()` per message type that stamps `MsgType`
5//! (e.g. `truefix_dict::fix44::NewOrderSingle::new()`), wrapping a generic [`Message`] so the
6//! result encodes byte-identically with the generic codec path (FR-021). This trait is a
7//! version-agnostic construction contract for callers who only have `begin_string`/`msg_type` at
8//! hand (e.g. a generic factory keyed off dictionary metadata) and don't need the typed accessors.
9
10use crate::message::Message;
11
12/// Constructs empty messages for a given protocol version and message type.
13pub trait MessageFactory {
14    /// Create an empty message for `begin_string` (e.g. `"FIX.4.4"`) and `msg_type`.
15    fn create(&self, begin_string: &str, msg_type: &str) -> Message;
16}