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::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};

use super::super::components::{CompIDReqGrp, Header, Trailer};
use super::super::enums::NetworkRequestType;

/// The `NetworkCounterpartySystemStatusRequest` (35=BC) message.
pub struct NetworkCounterpartySystemStatusRequest(RawMessage);

impl NetworkCounterpartySystemStatusRequest {
    pub const MSG_TYPE: &[u8] = b"BC";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(935), Tag(933), Tag(936)],
            &[Header::known_tags(), Trailer::known_tags(), CompIDReqGrp::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 `NetworkRequestType` (935) field.
    #[doc(alias = "NetworkRequestType")]
    pub fn network_request_type(&self) -> Result<Option<NetworkRequestType>, InvalidValue> {
        Ok(self.0.get_int(Tag(935))?.map(NetworkRequestType::from_value))
    }

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

    /// The instances of the `NoCompIDs` (936) group.
    #[doc(alias = "NoCompIDs")]
    pub fn comp_ids(&self) -> Result<Instances<'_, CompIDReqGrp<'_>>, InvalidValue> {
        self.0.get_group(&CompIDReqGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }
}

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

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