Skip to main content

refix_fix44/generated/components/
yield_data.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::YieldType;
7
8/// The fields of the `YieldData` component.
9#[derive(Clone, Copy)]
10pub struct YieldData<'a>(pub(in super::super) refix_message::Scope<'a>);
11
12impl<'a> YieldData<'a> {
13    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
14        static TAGS: LazyKnownTags = LazyKnownTags::new(
15            &[Tag(235), Tag(236), Tag(701), Tag(696), Tag(697), Tag(698)],
16            &[],
17        );
18        &TAGS
19    }
20
21    pub fn raw(&self) -> refix_message::Scope<'a> {
22        self.0
23    }
24
25    /// The `YieldType` (235) field.
26    #[doc(alias = "YieldType")]
27    pub fn yield_type(&self) -> Result<Option<YieldType<'a>>, InvalidValue> {
28        Ok(self.0.get_str(Tag(235))?.map(YieldType::from_value))
29    }
30
31    /// The `Yield` (236) field.
32    #[doc(alias = "Yield")]
33    pub fn r#yield(&self) -> Result<Option<Decimal>, InvalidValue> {
34        self.0.get_decimal(Tag(236))
35    }
36
37    /// The `YieldCalcDate` (701) field.
38    #[doc(alias = "YieldCalcDate")]
39    pub fn yield_calc_date(&self) -> Result<Option<Date>, InvalidValue> {
40        self.0.get_date(Tag(701))
41    }
42
43    /// The `YieldRedemptionDate` (696) field.
44    #[doc(alias = "YieldRedemptionDate")]
45    pub fn yield_redemption_date(&self) -> Result<Option<Date>, InvalidValue> {
46        self.0.get_date(Tag(696))
47    }
48
49    /// The `YieldRedemptionPrice` (697) field.
50    #[doc(alias = "YieldRedemptionPrice")]
51    pub fn yield_redemption_price(&self) -> Result<Option<Decimal>, InvalidValue> {
52        self.0.get_decimal(Tag(697))
53    }
54
55    /// The `YieldRedemptionPriceType` (698) field.
56    #[doc(alias = "YieldRedemptionPriceType")]
57    pub fn yield_redemption_price_type(&self) -> Result<Option<i64>, InvalidValue> {
58        self.0.get_int(Tag(698))
59    }
60}
61
62impl std::fmt::Debug for YieldData<'_> {
63    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
64        write!(f, "YieldData({})", self.0.display_known(&Self::known_tags().get()))
65    }
66}