rusmpp_core/values/
user_message_reference.rs

1use rusmpp_macros::Rusmpp;
2
3/// A reference assigned by the originating SME to the short message. Depending on the
4/// destination network technology, this field may be passed directly to the mobile device.
5///
6/// The user_message_reference TLV is also applicable in ancillary broadcast operations as a
7/// means of identifying a previously submitted message. In such cases, the
8/// user_message_reference can be used to substitute an actual message_id or may be used in
9/// conjunction with a message_id.
10#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Rusmpp)]
11#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
12#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
13#[cfg_attr(feature = "serde-deserialize-unchecked", derive(::serde::Deserialize))]
14pub struct UserMessageReference {
15    pub value: u16,
16}
17
18impl UserMessageReference {
19    pub const fn new(value: u16) -> Self {
20        Self { value }
21    }
22}
23
24impl From<u16> for UserMessageReference {
25    fn from(value: u16) -> Self {
26        Self::new(value)
27    }
28}
29
30impl From<UserMessageReference> for u16 {
31    fn from(value: UserMessageReference) -> Self {
32        value.value
33    }
34}