pub struct FieldRef<'a> {
pub tag: u32,
pub value: &'a [u8],
}Expand description
Zero-copy reference to a field within a FIX message buffer.
This struct holds references to the original message buffer, avoiding allocation during parsing.
Fields§
§tag: u32The field tag number.
value: &'a [u8]Reference to the field value bytes (without delimiters).
Implementations§
Source§impl<'a> FieldRef<'a>
impl<'a> FieldRef<'a>
Sourcepub const fn new(tag: u32, value: &'a [u8]) -> Self
pub const fn new(tag: u32, value: &'a [u8]) -> Self
Creates a new field reference.
§Arguments
tag- The field tag numbervalue- Reference to the value bytes
Sourcepub fn as_str(&self) -> Result<&'a str, DecodeError>
pub fn as_str(&self) -> Result<&'a str, DecodeError>
Returns the value as a string slice.
§Errors
Returns DecodeError::InvalidUtf8 if the value is not valid UTF-8.
Sourcepub fn to_string(&self) -> Result<String, DecodeError>
pub fn to_string(&self) -> Result<String, DecodeError>
Returns the value as an owned String.
§Errors
Returns DecodeError::InvalidUtf8 if the value is not valid UTF-8.
Sourcepub fn parse<T: FromStr>(&self) -> Result<T, DecodeError>
pub fn parse<T: FromStr>(&self) -> Result<T, DecodeError>
Parses the value as the specified type.
§Errors
Returns DecodeError::InvalidFieldValue if parsing fails.
Sourcepub fn as_u64(&self) -> Result<u64, DecodeError>
pub fn as_u64(&self) -> Result<u64, DecodeError>
Returns the value as a u64.
§Errors
Returns DecodeError::InvalidFieldValue if the value is not a valid integer.
Sourcepub fn as_i64(&self) -> Result<i64, DecodeError>
pub fn as_i64(&self) -> Result<i64, DecodeError>
Returns the value as an i64.
§Errors
Returns DecodeError::InvalidFieldValue if the value is not a valid integer.
Sourcepub fn as_decimal(&self) -> Result<Decimal, DecodeError>
pub fn as_decimal(&self) -> Result<Decimal, DecodeError>
Returns the value as a Decimal.
§Errors
Returns DecodeError::InvalidFieldValue if the value is not a valid decimal.
Sourcepub fn as_bool(&self) -> Result<bool, DecodeError>
pub fn as_bool(&self) -> Result<bool, DecodeError>
Returns the value as a bool (FIX uses ‘Y’/‘N’).
§Errors
Returns DecodeError::InvalidFieldValue if the value is not ‘Y’ or ‘N’.