refix-fix44 0.12.0

Typed FIX 4.4 protocol messages for the ReFIX engine
Documentation
// @generated by refix codegen from FIX44.xml. Do not edit.
#![cfg_attr(rustfmt, rustfmt::skip)]

use refix_message::{InvalidValue, LazyKnownTags, RawMessage, Tag};

use super::super::components::{Header, Trailer, UnderlyingInstrument};
use super::super::enums::{SecurityListRequestType, SubscriptionRequestType};

/// The `DerivativeSecurityListRequest` (35=z) message.
pub struct DerivativeSecurityListRequest(RawMessage);

impl DerivativeSecurityListRequest {
    pub const MSG_TYPE: &[u8] = b"z";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(320), Tag(559), Tag(762), Tag(15), Tag(58), Tag(354), Tag(355), Tag(336),
                Tag(625), Tag(263),
            ],
            &[Header::known_tags(), Trailer::known_tags(), UnderlyingInstrument::known_tags()],
        );
        &TAGS
    }

    pub fn from_raw(raw: RawMessage) -> Self {
        Self(raw)
    }

    pub fn raw(&self) -> &RawMessage {
        &self.0
    }

    pub fn header(&self) -> Header<'_> {
        Header(self.0.scope(), Self::known_tags().get())
    }

    pub fn trailer(&self) -> Trailer<'_> {
        Trailer(self.0.scope())
    }

    /// The `SecurityReqID` (320) field.
    #[doc(alias = "SecurityReqID")]
    pub fn security_req_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(320))
    }

    /// The `SecurityListRequestType` (559) field.
    #[doc(alias = "SecurityListRequestType")]
    pub fn security_list_request_type(&self) -> Result<Option<SecurityListRequestType>, InvalidValue> {
        Ok(self.0.get_int(Tag(559))?.map(SecurityListRequestType::from_value))
    }

    /// The `UnderlyingInstrument` component.
    pub fn underlying_instrument(&self) -> UnderlyingInstrument<'_> {
        UnderlyingInstrument(self.0.scope(), Self::known_tags().get())
    }

    /// The `SecuritySubType` (762) field.
    #[doc(alias = "SecuritySubType")]
    pub fn security_sub_type(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(762))
    }

    /// The `Currency` (15) field.
    #[doc(alias = "Currency")]
    pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(15))
    }

    /// The `Text` (58) field.
    #[doc(alias = "Text")]
    pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(58))
    }

    /// The `EncodedTextLen` (354) field.
    #[doc(alias = "EncodedTextLen")]
    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(354))
    }

    /// The `EncodedText` (355) field.
    #[doc(alias = "EncodedText")]
    pub fn encoded_text(&self) -> Option<&[u8]> {
        self.0.get(Tag(355))
    }

    /// The `TradingSessionID` (336) field.
    #[doc(alias = "TradingSessionID")]
    pub fn trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(336))
    }

    /// The `TradingSessionSubID` (625) field.
    #[doc(alias = "TradingSessionSubID")]
    pub fn trading_session_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(625))
    }

    /// The `SubscriptionRequestType` (263) field.
    #[doc(alias = "SubscriptionRequestType")]
    pub fn subscription_request_type(&self) -> Result<Option<SubscriptionRequestType<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(263))?.map(SubscriptionRequestType::from_value))
    }
}

impl std::fmt::Debug for DerivativeSecurityListRequest {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "DerivativeSecurityListRequest({})", self.0)
    }
}

impl std::fmt::Display for DerivativeSecurityListRequest {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(&self.0, f)
    }
}