Skip to main content

refix_fix44/generated/components/
financing_details.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Date, Decimal, InvalidValue, LazyKnownTags, Tag};
5
6use super::super::enums::{DeliveryType, TerminationType};
7
8/// The fields of the `FinancingDetails` component.
9#[derive(Clone, Copy)]
10pub struct FinancingDetails<'a>(pub(in super::super) refix_message::Scope<'a>);
11
12impl<'a> FinancingDetails<'a> {
13    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
14        static TAGS: LazyKnownTags = LazyKnownTags::new(
15            &[
16                Tag(913), Tag(914), Tag(915), Tag(918), Tag(788), Tag(916), Tag(917), Tag(919),
17                Tag(898),
18            ],
19            &[],
20        );
21        &TAGS
22    }
23
24    pub fn raw(&self) -> refix_message::Scope<'a> {
25        self.0
26    }
27
28    /// The `AgreementDesc` (913) field.
29    #[doc(alias = "AgreementDesc")]
30    pub fn agreement_desc(&self) -> Result<Option<&'a str>, InvalidValue> {
31        self.0.get_str(Tag(913))
32    }
33
34    /// The `AgreementID` (914) field.
35    #[doc(alias = "AgreementID")]
36    pub fn agreement_id(&self) -> Result<Option<&'a str>, InvalidValue> {
37        self.0.get_str(Tag(914))
38    }
39
40    /// The `AgreementDate` (915) field.
41    #[doc(alias = "AgreementDate")]
42    pub fn agreement_date(&self) -> Result<Option<Date>, InvalidValue> {
43        self.0.get_date(Tag(915))
44    }
45
46    /// The `AgreementCurrency` (918) field.
47    #[doc(alias = "AgreementCurrency")]
48    pub fn agreement_currency(&self) -> Result<Option<&'a str>, InvalidValue> {
49        self.0.get_str(Tag(918))
50    }
51
52    /// The `TerminationType` (788) field.
53    #[doc(alias = "TerminationType")]
54    pub fn termination_type(&self) -> Result<Option<TerminationType>, InvalidValue> {
55        Ok(self.0.get_int(Tag(788))?.map(TerminationType::from_value))
56    }
57
58    /// The `StartDate` (916) field.
59    #[doc(alias = "StartDate")]
60    pub fn start_date(&self) -> Result<Option<Date>, InvalidValue> {
61        self.0.get_date(Tag(916))
62    }
63
64    /// The `EndDate` (917) field.
65    #[doc(alias = "EndDate")]
66    pub fn end_date(&self) -> Result<Option<Date>, InvalidValue> {
67        self.0.get_date(Tag(917))
68    }
69
70    /// The `DeliveryType` (919) field.
71    #[doc(alias = "DeliveryType")]
72    pub fn delivery_type(&self) -> Result<Option<DeliveryType>, InvalidValue> {
73        Ok(self.0.get_int(Tag(919))?.map(DeliveryType::from_value))
74    }
75
76    /// The `MarginRatio` (898) field.
77    #[doc(alias = "MarginRatio")]
78    pub fn margin_ratio(&self) -> Result<Option<Decimal>, InvalidValue> {
79        self.0.get_decimal(Tag(898))
80    }
81}
82
83impl std::fmt::Debug for FinancingDetails<'_> {
84    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
85        write!(f, "FinancingDetails({})", self.0.display_known(&Self::known_tags().get()))
86    }
87}