Struct huawei_modem::pdu::PduAddress
source · pub struct PduAddress {
pub type_addr: AddressType,
pub number: PhoneNumber,
}
Expand description
A PDU address (i.e. phone number, and number type). This is what you want to use for representing phone numbers, most likely.
Use the FromStr
implementation here to convert regular string phone numbers into weird PDU
format. Note that alphanumeric numbers are not supported at this time (only normal phone
numbers).
Fields§
§type_addr: AddressType
§number: PhoneNumber
Implementations§
source§impl PduAddress
impl PduAddress
sourcepub fn as_bytes(&self, broken_len: bool) -> Vec<u8>
pub fn as_bytes(&self, broken_len: bool) -> Vec<u8>
Convert this address into bytes, as represented in the actual PDU.
The broken_len
flag controls whether to represent the length as the length in bytes of
the whole PduAddress (false), or just the length of the phone number contained within (true).
In testing, it seems as if it should pretty much always be true
, which is weird. A future
version of the crate may well just remove the parameter and default to true.
Trait Implementations§
source§impl Clone for PduAddress
impl Clone for PduAddress
source§fn clone(&self) -> PduAddress
fn clone(&self) -> PduAddress
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PduAddress
impl Debug for PduAddress
source§impl Display for PduAddress
impl Display for PduAddress
source§impl FromStr for PduAddress
impl FromStr for PduAddress
§type Err = Infallible
type Err = Infallible
The associated error which can be returned from parsing.
source§impl Hash for PduAddress
impl Hash for PduAddress
source§impl PartialEq<PduAddress> for PduAddress
impl PartialEq<PduAddress> for PduAddress
source§fn eq(&self, other: &PduAddress) -> bool
fn eq(&self, other: &PduAddress) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'a> TryFrom<&'a [u8]> for PduAddress
impl<'a> TryFrom<&'a [u8]> for PduAddress
§type Error = HuaweiError
type Error = HuaweiError
The type returned in the event of a conversion error.
source§fn try_from(b: &[u8]) -> HuaweiResult<Self>
fn try_from(b: &[u8]) -> HuaweiResult<Self>
Performs the conversion.
impl Eq for PduAddress
impl StructuralEq for PduAddress
impl StructuralPartialEq for PduAddress
Auto Trait Implementations§
impl RefUnwindSafe for PduAddress
impl Send for PduAddress
impl Sync for PduAddress
impl Unpin for PduAddress
impl UnwindSafe for PduAddress
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