SMSDeliver

Struct SMSDeliver 

Source
pub struct SMSDeliver;

Implementations§

Source§

impl SMSDeliver

Source

pub fn decode(data: &str) -> Result<SmsDeliverDecoded>

Decodes an SMS-DELIVER TP-DU.

Examples found in repository?
examples/decode_sms.rs (line 45)
40fn example_detailed_api() {
41    println!("--- Example 2: Detailed API ---");
42
43    let pdu = "07916407058099F9040B916407950303F100008921222140140004D4E2940A";
44
45    match SmsDeliver::decode(pdu) {
46        Ok(sms) => {
47            if let Some(ref number) = sms.smsc.number {
48                println!("SMSC Number: {}", number);
49            }
50            if let Some(ref toa) = sms.smsc.toa {
51                println!("SMSC TON: {}", toa.ton);
52                println!("SMSC NPI: {}", toa.npi);
53            }
54            println!();
55            println!("Sender Number: {}", sms.sender.number);
56            println!("Sender TON: {}", sms.sender.toa.ton);
57            println!();
58            println!("Message Type: {}", sms.header.mti);
59            println!("Has UDH: {}", sms.header.udhi);
60            println!("More Messages: {}", sms.header.mms);
61            println!();
62            println!("Protocol ID: {}", sms.pid);
63            println!("Encoding: {}", sms.dcs.encoding);
64            println!();
65            println!("Timestamp: {}", sms.scts);
66            println!("Timestamp (RFC3339): {}", sms.scts.to_rfc3339());
67            println!();
68            println!("Message: {}", sms.user_data.data);
69            println!("Has Header: {}", sms.user_data.header.is_some());
70        }
71        Err(e) => eprintln!("Error: {}", e),
72    }
73    println!();
74}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.