pub struct OwnedMessage { /* private fields */ }Expand description
Owned FIX message for storage and cross-thread transfer.
Unlike RawMessage, this struct owns its data and can be
safely sent across threads or stored for later use.
Implementations§
Source§impl OwnedMessage
impl OwnedMessage
Sourcepub fn from_raw(raw: &RawMessage<'_>) -> Self
pub fn from_raw(raw: &RawMessage<'_>) -> Self
Creates an OwnedMessage from a RawMessage.
§Borrow invariant
Field offsets are recovered by subtracting the buffer’s address from
each field value’s address, so every FieldRef in raw must borrow
from raw.buffer() — which is what a decoder that produced both
guarantees. A field pointing anywhere else has no offset in this
buffer; rather than computing a wrapped or out-of-range one, it is
dropped, and field_count() on the result is correspondingly
lower. Such a RawMessage is a construction bug in whatever produced
it, not an input this type can repair.
§Arguments
raw- The raw message to copy
Sourcepub fn new(
buffer: Bytes,
msg_type: MsgType,
field_offsets: Vec<(u32, Range<usize>)>,
) -> Self
pub fn new( buffer: Bytes, msg_type: MsgType, field_offsets: Vec<(u32, Range<usize>)>, ) -> Self
Creates an OwnedMessage from raw bytes.
§Arguments
buffer- The message bytesmsg_type- The message typefield_offsets- Field tag and value range pairs
Sourcepub fn get_field_str(&self, tag: u32) -> Option<&str>
pub fn get_field_str(&self, tag: u32) -> Option<&str>
Sourcepub fn field_count(&self) -> usize
pub fn field_count(&self) -> usize
Returns the number of fields.
Sourcepub fn into_bytes(self) -> Bytes
pub fn into_bytes(self) -> Bytes
Consumes the message and returns the underlying buffer.
Trait Implementations§
Source§impl Clone for OwnedMessage
impl Clone for OwnedMessage
Source§fn clone(&self) -> OwnedMessage
fn clone(&self) -> OwnedMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more