GSM

Struct GSM 

Source
pub struct GSM;
Expand description

— GSM 7-bit Codec —

Implementations§

Source§

impl GSM

Source

pub fn decode(data: &str, strip_padding: bool) -> Result<String>

Returns decoded message from PDU string.

Examples found in repository?
examples/decode_sms.rs (line 82)
76fn example_codecs() {
77    println!("--- Example 3: Direct Codec Usage ---");
78
79    // GSM 7-bit
80    println!("GSM 7-bit decoding:");
81    let gsm_hex = "C8F71D14969741F977FD07";
82    match Gsm7Bit::decode(gsm_hex, false) {
83        Ok(text) => println!("  '{}' -> '{}'", gsm_hex, text),
84        Err(e) => eprintln!("  Error: {}", e),
85    }
86
87    // Another GSM 7-bit example
88    let gsm_hex2 = "D4E2940A";
89    match Gsm7Bit::decode(gsm_hex2, false) {
90        Ok(text) => println!("  '{}' -> '{}'", gsm_hex2, text),
91        Err(e) => eprintln!("  Error: {}", e),
92    }
93
94    println!();
95
96    // UCS2
97    println!("UCS2 (Unicode) decoding:");
98    let ucs2_hex = "004C006F00720065006D00200049007000730075006D";
99    match Ucs2::decode(ucs2_hex) {
100        Ok(text) => println!("  '{}' -> '{}'", ucs2_hex, text),
101        Err(e) => eprintln!("  Error: {}", e),
102    }
103
104    println!();
105}
Source

pub fn decode_with_length(bytes: &[u8], length: usize) -> Result<String>

Decode with specified length (used for alphanumeric addresses)

Source

pub fn encode(data: &str, with_padding: bool) -> Result<String>

Returns an encoded PDU string.

Auto Trait Implementations§

§

impl Freeze for GSM

§

impl RefUnwindSafe for GSM

§

impl Send for GSM

§

impl Sync for GSM

§

impl Unpin for GSM

§

impl UnwindSafe for GSM

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.