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: CallsignStation callsign (1-6 uppercase ASCII alphanumerics).
ssid: SsidSecondary Station Identifier (0-15).
repeated: boolHas-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: boolAX.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
impl Ax25Address
pub fn new(callsign: &str, ssid: u8) -> 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>
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
impl Clone for Ax25Address
§fn clone(&self) -> Ax25Address
fn clone(&self) -> Ax25Address
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more