pub enum Field {
MsgSeqNum(MsgSeqNum),
SenderCompID(SenderCompID),
SendingTime(SendingTime),
TargetCompID(TargetCompID),
Custom {
tag: u16,
value: Vec<u8>,
},
}Expand description
Represents a single FIX field.
Each variant corresponds to a strongly-typed FIX tag, such as
MsgSeqNum(34) or SenderCompID(49). Fields not covered by
predefined variants can be represented using Field::Custom.
Variants§
MsgSeqNum(MsgSeqNum)
Message sequence number (34).
Used to identify message ordering within a FIX session.
SenderCompID(SenderCompID)
Sender company or system identifier (49).
Identifies the sender of the message in a FIX session.
SendingTime(SendingTime)
Message sending time (52).
Timestamp representing when the message was sent.
TargetCompID(TargetCompID)
Target company or system identifier (56).
Identifies the intended recipient of the message in a FIX session.
Custom
Represents an arbitrary or user-defined FIX field not covered by the predefined variants.
Useful for extension tags, firm-specific fields, or when working with non-standard message structures.
Implementations§
Source§impl Field
impl Field
Sourcepub fn tag(&self) -> u16
pub fn tag(&self) -> u16
Returns the numeric FIX tag associated with this field.
Example usage:
use trafix_codec::message::field::{Field, value::aliases::MsgSeqNum};
let f = Field::MsgSeqNum(1);
assert_eq!(f.tag(), 34);Sourcepub fn value(&self) -> Vec<u8> ⓘ
pub fn value(&self) -> Vec<u8> ⓘ
Returns the serialized value of the field as raw bytes.
For predefined fields, this returns their encoded textual representation (e.g. integer → ASCII). For custom fields, the original byte vector is cloned.
Sourcepub fn encode(&self) -> Vec<u8> ⓘ
pub fn encode(&self) -> Vec<u8> ⓘ
Serializes the field into its "tag=value" representation.
This does not append the SOH delimiter; it only produces
the byte content for a single field. The encoder is
responsible for joining fields with SOH (0x01).
use trafix_codec::message::field::{Field, value::aliases::MsgSeqNum};
let f = Field::MsgSeqNum(4);
assert_eq!(f.encode(), b"34=4".to_vec());