Skip to main content

refix_fix44/generated/components/
parties.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{GroupTable, Instances, InvalidValue, LazyKnownTags, Tag};
5
6use super::super::enums::{PartyIDSource, PartyRole};
7use super::PtysSubGrp;
8
9/// An instance of the `NoPartyIDs` (453) group.
10#[derive(Clone, Copy)]
11pub struct Parties<'a>(refix_message::Scope<'a>);
12
13impl<'a> From<refix_message::Scope<'a>> for Parties<'a> {
14    fn from(scope: refix_message::Scope<'a>) -> Self {
15        Self(scope)
16    }
17}
18
19impl<'a> Parties<'a> {
20    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
21        Tag(453),
22        Tag(448),
23        &[Tag(447), Tag(448), Tag(452), Tag(802)],
24        &[PtysSubGrp::TABLE],
25    );
26
27    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
28        static TAGS: LazyKnownTags = LazyKnownTags::new(
29            &[Tag(448), Tag(447), Tag(452), Tag(802)],
30            &[PtysSubGrp::known_tags()],
31        );
32        &TAGS
33    }
34
35    pub fn raw(&self) -> refix_message::Scope<'a> {
36        self.0
37    }
38
39    /// The `PartyID` (448) field.
40    #[doc(alias = "PartyID")]
41    pub fn party_id(&self) -> Result<Option<&'a str>, InvalidValue> {
42        self.0.get_str(Tag(448))
43    }
44
45    /// The `PartyIDSource` (447) field.
46    #[doc(alias = "PartyIDSource")]
47    pub fn party_id_source(&self) -> Result<Option<PartyIDSource<'a>>, InvalidValue> {
48        Ok(self.0.get_str(Tag(447))?.map(PartyIDSource::from_value))
49    }
50
51    /// The `PartyRole` (452) field.
52    #[doc(alias = "PartyRole")]
53    pub fn party_role(&self) -> Result<Option<PartyRole>, InvalidValue> {
54        Ok(self.0.get_int(Tag(452))?.map(PartyRole::from_value))
55    }
56
57    /// The instances of the `NoPartySubIDs` (802) group.
58    #[doc(alias = "NoPartySubIDs")]
59    pub fn party_sub_ids(&self) -> Result<Instances<'a, PtysSubGrp<'a>>, InvalidValue> {
60        self.0.get_group(&PtysSubGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
61    }
62}
63
64impl std::fmt::Debug for Parties<'_> {
65    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
66        write!(f, "Parties({})", self.0)
67    }
68}