Skip to main content

Cusd

Struct Cusd 

Source
pub struct Cusd {
    pub status: CusdStatus,
    pub raw: Option<String>,
    pub dcs: Option<u8>,
    pub invalid_dcs: Option<String>,
}
Expand description

One +CUSD: <m>[,<str>[,<dcs>]] line.

Fields§

§status: CusdStatus§raw: Option<String>

<str> as sent (quotes removed, \" and \\ unescaped), not decoded; see Cusd::text, Cusd::text_as and Cusd::text_packed_hex.

§dcs: Option<u8>

<dcs> when it is a number 0–255.

§invalid_dcs: Option<String>

A <dcs> that is present but not a number 0–255 (e.g. 300), as sent. dcs is then None and the text is read with the default DCS 0.

Implementations§

Source§

impl Cusd

Source

pub fn text(&self) -> Option<String>

Decoded text with +CSCS="GSM" or "IRA" (the default): same as text_as(Cscs::Gsm).

Source

pub fn text_as(&self, cscs: Cscs) -> Option<String>

Decoded text per 27.007 §7.15 with the given TE character set.

  • 8-bit / UCS2 <dcs>: <str> is the octets in hex whatever +CSCS is; they are decoded with decode. A <str> that is not hex is returned as sent.
  • GSM 7-bit <dcs> (or none: 27.007 default 0): <str> is in cscs. None when it is not valid hex for Cscs::Ucs2 / Cscs::Hex.

None without <str> and for compressed data (23.042, not supported). Firmware that sends packed septets in hex under a GSM 7-bit DCS needs Cusd::text_packed_hex.

Source

pub fn text_packed_hex(&self) -> Option<String>

Not standard: some firmware (Huawei E160 and others, seen in gammu’s dumps) sends the network’s packed 7-bit USSD octets in hex under a GSM 7-bit <dcs> instead of converting them to the TE character set. Decode that ("AA58ACA6AA8D1A" → "*115*5#"). None when <str> is not hex; with an 8-bit / UCS2 <dcs> this is Cusd::text.

Trait Implementations§

Source§

impl Clone for Cusd

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Cusd

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Cusd

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Cusd

Source§

impl PartialEq for Cusd

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Cusd

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Cusd

Auto Trait Implementations§

§

impl Forget for Cusd

§

impl Freeze for Cusd

§

impl RefUnwindSafe for Cusd

§

impl Send for Cusd

§

impl Sync for Cusd

§

impl Unpin for Cusd

§

impl UnsafeUnpin for Cusd

§

impl UnwindSafe for Cusd

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.