pub struct Encoder { /* private fields */ }Expand description
Implementations§
Source§impl Encoder
impl Encoder
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a new encoder pre-allocated for capacity body bytes.
Sourcepub fn disable_auto_calculate_body_length(&mut self, disable: bool) -> &mut Self
pub fn disable_auto_calculate_body_length(&mut self, disable: bool) -> &mut Self
When set to true, tag 9 (BodyLength) will not be auto-computed.
If the message contains tag 9, its value is written as-is; otherwise
the field is omitted entirely.
When false (the default), tag 9 is always computed from the body length.
Sourcepub fn disable_auto_calculate_checksum(&mut self, disable: bool) -> &mut Self
pub fn disable_auto_calculate_checksum(&mut self, disable: bool) -> &mut Self
When set to true, tag 10 (CheckSum) will not be auto-computed.
If the message contains tag 10, its value is written as-is; otherwise
the field is omitted entirely.
When false (the default), tag 10 is always computed from the message bytes.
Sourcepub fn encode(
&mut self,
msg: &Message<'_>,
out: &mut Vec<u8>,
) -> Result<(), FixError>
pub fn encode( &mut self, msg: &Message<'_>, out: &mut Vec<u8>, ) -> Result<(), FixError>
Encode msg as a complete FIX wire message into out.
out is cleared first. By default, tag 9 (BodyLength) and tag 10 (CheckSum)
are computed automatically and any existing 9 or 10 fields in msg are ignored.
Use disable_auto_calculate_body_length(true) or
disable_auto_calculate_checksum(true) to write the message’s own values instead.
If tag 8 (BeginString) is absent, FIX.4.4 is used as the default version.