pub trait SessionMessage:
Sized
+ Debug
+ HeaderAccess {
// Required methods
fn from_raw_message(
raw: RawMessage<'_>,
) -> Result<Box<Self>, DeserializeError>;
fn serialize(&self, buf: &mut [u8]) -> Result<usize, SerializeError>;
fn header(&self) -> HeaderBase<'_>;
fn try_as_admin(&self) -> Option<AdminBase<'_>>;
fn msg_type(&self) -> MsgTypeField;
fn msg_cat(&self) -> MsgCat;
fn name(&self) -> &'static str;
fn from_admin(
header: HeaderBase<'static>,
admin: AdminBase<'static>,
) -> Self;
// Provided method
fn from_bytes(bytes: &[u8]) -> Result<Box<Self>, DeserializeError> { ... }
}Expand description
Core message trait that bridges session logic and concrete message types.
The session layer uses this trait to deserialize, inspect, construct, and serialize messages without knowing the concrete type.
Required Methods§
Sourcefn from_raw_message(raw: RawMessage<'_>) -> Result<Box<Self>, DeserializeError>
fn from_raw_message(raw: RawMessage<'_>) -> Result<Box<Self>, DeserializeError>
Deserialize from a structurally validated RawMessage.
On failure the DeserializeError carries the parsed header whenever
header parsing succeeded before the failure.
Sourcefn serialize(&self, buf: &mut [u8]) -> Result<usize, SerializeError>
fn serialize(&self, buf: &mut [u8]) -> Result<usize, SerializeError>
Serialize to FIX tag-value wire format into the caller-provided buffer. Returns the number of bytes written.
Sourcefn header(&self) -> HeaderBase<'_>
fn header(&self) -> HeaderBase<'_>
Extract header fields as a borrowed base. Zero-copy.
Sourcefn try_as_admin(&self) -> Option<AdminBase<'_>>
fn try_as_admin(&self) -> Option<AdminBase<'_>>
If this is an admin message, return the borrowed base. Zero-copy.
Sourcefn msg_type(&self) -> MsgTypeField
fn msg_type(&self) -> MsgTypeField
Compact message type identifier (e.g. "A" for Logon, "D" for
NewOrderSingle).
Compare against MsgTypeBase variants for admin dispatch, or
TryFrom into a richer generated type for exhaustive matching -
fallible, since the field may hold a value that type does not define.
Sourcefn from_admin(header: HeaderBase<'static>, admin: AdminBase<'static>) -> Self
fn from_admin(header: HeaderBase<'static>, admin: AdminBase<'static>) -> Self
Build an outgoing admin message from owned base messages.
Provided Methods§
Sourcefn from_bytes(bytes: &[u8]) -> Result<Box<Self>, DeserializeError>
fn from_bytes(bytes: &[u8]) -> Result<Box<Self>, DeserializeError>
Deserialize from FIX tag-value wire bytes. Composes raw_message
framing with Self::from_raw_message.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".