Skip to main content

Plmn

Struct Plmn 

pub struct Plmn {
    mcc: [u8; 3],
    mnc: [u8; 3],
    three_digit_mnc: bool,
}
Expand description

A network ID: the mobile country code (MCC) and mobile network code (MNC).

The MCC has three digits. The MNC has two or three digits. The leading zero of a two digit MNC is kept, so 01 and 001 are different networks.

§Example

let plmn = ql_nas::Plmn::new("262", "01").expect("valid digits");
assert_eq!(plmn.mcc(), "262");
assert_eq!(plmn.mnc(), "01");

Fields§

§mcc: [u8; 3]§mnc: [u8; 3]§three_digit_mnc: bool

Implementations§

§

impl Plmn

pub fn new(mcc: &str, mnc: &str) -> Option<Self>

Returns the network ID, or None if the MCC isn’t three ASCII digits or the MNC isn’t two or three ASCII digits.

pub fn mcc(&self) -> &str

Returns the mobile country code.

pub fn mnc(&self) -> &str

Returns the mobile network code with two or three digits.

pub const fn has_three_digit_mnc(&self) -> bool

Returns whether the MNC has three digits.

pub(crate) fn from_ascii(mcc: [u8; 3], mnc: [u8; 3]) -> Option<Self>

Reads the ASCII form of nas_common_network_id_type_v01.

The third MNC byte is 0xFF or zero for a two digit MNC.

pub(crate) fn from_codes( mcc: u16, mnc: u16, three_digit_mnc: bool, ) -> Option<Self>

Reads the numeric codes of nas_mnc_pcs_digit_include_status_type_v01.

Returns None if a code has too many digits.

pub(crate) fn mcc_code(self) -> u16

Returns the MCC as a number.

pub(crate) fn mnc_code(self) -> u16

Returns the MNC as a number.

pub(crate) fn from_bcd(bytes: [u8; 3]) -> Option<Self>

Reads the BCD form from 3GPP TS 24.008 section 10.5.1.3.

The bytes hold MCC 2 and 1, MNC 3 and MCC 3, and MNC 2 and 1, high nibble first. MNC 3 is 0xF for a two digit MNC.

fn digits(&self) -> impl Iterator<Item = u8>

Trait Implementations§

§

impl Clone for Plmn

§

fn clone(&self) -> Plmn

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
§

impl Copy for Plmn

§

impl Debug for Plmn

§

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

Formats the value using the given formatter. Read more
§

impl Eq for Plmn

§

impl Hash for Plmn

§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl PartialEq for Plmn

§

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

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

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

Inequality operator !=. Read more
§

impl StructuralPartialEq for Plmn

Auto Trait Implementations§

§

impl Freeze for Plmn

§

impl RefUnwindSafe for Plmn

§

impl Send for Plmn

§

impl Sync for Plmn

§

impl Unpin for Plmn

§

impl UnsafeUnpin for Plmn

§

impl UnwindSafe for Plmn

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, <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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more