pub struct UCS2;Expand description
— UCS2 Codec —
Implementations§
Source§impl UCS2
impl UCS2
Sourcepub fn decode(data: &str) -> Result<String>
pub fn decode(data: &str) -> Result<String>
Returns decoded message from PDU string.
Examples found in repository?
examples/decode_sms.rs (line 99)
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}Sourcepub fn decode_bytes(bytes: &[u8]) -> Result<String>
pub fn decode_bytes(bytes: &[u8]) -> Result<String>
Decode bytes directly (used internally)
Auto Trait Implementations§
impl Freeze for UCS2
impl RefUnwindSafe for UCS2
impl Send for UCS2
impl Sync for UCS2
impl Unpin for UCS2
impl UnwindSafe for UCS2
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more