refix_fix44/generated/messages/
user_response.rs1#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{InvalidValue, LazyKnownTags, RawMessage, Tag};
5
6use super::super::components::{Header, Trailer};
7use super::super::enums::UserStatus;
8
9pub struct UserResponse(RawMessage);
11
12impl UserResponse {
13 pub const MSG_TYPE: &[u8] = b"BF";
14
15 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
16 static TAGS: LazyKnownTags = LazyKnownTags::new(
17 &[Tag(923), Tag(553), Tag(926), Tag(927)],
18 &[Header::known_tags(), Trailer::known_tags()],
19 );
20 &TAGS
21 }
22
23 pub fn from_raw(raw: RawMessage) -> Self {
24 Self(raw)
25 }
26
27 pub fn raw(&self) -> &RawMessage {
28 &self.0
29 }
30
31 pub fn header(&self) -> Header<'_> {
32 Header(self.0.scope(), Self::known_tags().get())
33 }
34
35 pub fn trailer(&self) -> Trailer<'_> {
36 Trailer(self.0.scope())
37 }
38
39 #[doc(alias = "UserRequestID")]
41 pub fn user_request_id(&self) -> Result<Option<&str>, InvalidValue> {
42 self.0.get_str(Tag(923))
43 }
44
45 #[doc(alias = "Username")]
47 pub fn username(&self) -> Result<Option<&str>, InvalidValue> {
48 self.0.get_str(Tag(553))
49 }
50
51 #[doc(alias = "UserStatus")]
53 pub fn user_status(&self) -> Result<Option<UserStatus>, InvalidValue> {
54 Ok(self.0.get_int(Tag(926))?.map(UserStatus::from_value))
55 }
56
57 #[doc(alias = "UserStatusText")]
59 pub fn user_status_text(&self) -> Result<Option<&str>, InvalidValue> {
60 self.0.get_str(Tag(927))
61 }
62}
63
64impl std::fmt::Debug for UserResponse {
65 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
66 write!(f, "UserResponse({})", self.0)
67 }
68}
69
70impl std::fmt::Display for UserResponse {
71 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
72 std::fmt::Display::fmt(&self.0, f)
73 }
74}