Ax25Address

Struct Ax25Address 

pub struct Ax25Address {
    pub callsign: Callsign,
    pub ssid: Ssid,
    pub repeated: bool,
    pub c_bit: bool,
}
Expand description

An AX.25 v2.2 address: a 1-6 char callsign plus a 0-15 SSID, with the has-been-repeated (H-bit) and command/response (C-bit) flags that ride on the wire SSID byte.

Both fields use the validated newtypes [Callsign] and [Ssid]. Callsign derefs to &str and compares against &str/String, so most existing code that reads addr.callsign continues to work. Ssid compares against u8 and provides .get() for arithmetic.

Fields§

§callsign: Callsign

Station callsign (1-6 uppercase ASCII alphanumerics).

§ssid: Ssid

Secondary Station Identifier (0-15).

§repeated: bool

Has-been-repeated flag (H-bit).

For digipeater addresses, indicates this hop has already been consumed. Encoded as bit 7 of the SSID byte in AX.25 wire format.

§c_bit: bool

AX.25 v2.2 Command/Response bit (bit 7 of the SSID byte for destination/source addresses; the H-bit for digipeaters). Stored at parse time so callers can reconstruct the command/response classification of the original frame; ignored when building a frame (build always emits 0).

Implementations§

§

impl Ax25Address

pub fn new(callsign: &str, ssid: u8) -> Ax25Address

Create a new address with the H-bit unset (not yet repeated).

§Panics

Panics if callsign is empty, longer than 6 characters, contains non-alphanumeric characters, or if ssid > 15. Use Self::try_new for fallible construction from untrusted input. This infallible constructor exists for test helpers and internal code paths that already know the values are well-formed.

pub fn try_new(callsign: &str, ssid: u8) -> Result<Ax25Address, Ax25Error>

Create a new address with validation.

Rejects empty or malformed callsigns (must be 1-6 uppercase ASCII alphanumeric characters) and out-of-range SSIDs (must be 0-15). Accepts mixed-case input and uppercases internally.

§Errors

Returns Ax25Error::InvalidCallsign or Ax25Error::InvalidSsid if either field fails its validation rules.

Trait Implementations§

§

impl Clone for Ax25Address

§

fn clone(&self) -> Ax25Address

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
§

impl Debug for Ax25Address

§

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

Formats the value using the given formatter. Read more
§

impl Display for Ax25Address

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for Ax25Address

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Eq for Ax25Address

§

impl StructuralPartialEq for Ax25Address

Auto Trait Implementations§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
§

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