Struct Suffix
pub struct Suffix(/* private fields */);Expand description
4-byte D-STAR callsign suffix.
Implementations§
§impl Suffix
impl Suffix
pub fn try_from_str(s: &str) -> Result<Suffix, TypeError>
pub fn try_from_str(s: &str) -> Result<Suffix, TypeError>
Try to build a Suffix from a string slice.
- Must be ASCII
- Trailing whitespace is trimmed before the length check
- The trimmed length must be 0..=4 bytes
- Result is space-padded to exactly 4 bytes
§Errors
Returns TypeError::InvalidSuffix if s is longer than 4
bytes (after trimming) or contains non-ASCII characters.
§Example
use dstar_gateway_core::Suffix;
let s = Suffix::try_from_str("ECHO")?;
assert_eq!(s.as_bytes(), b"ECHO");pub const fn from_wire_bytes(bytes: [u8; 4]) -> Suffix
pub const fn from_wire_bytes(bytes: [u8; 4]) -> Suffix
Build a Suffix directly from 4 wire bytes, storing them
verbatim. Same rationale as super::callsign::Callsign::from_wire_bytes.
Trait Implementations§
impl Copy for Suffix
impl Eq for Suffix
impl StructuralPartialEq for Suffix
Auto Trait Implementations§
impl Freeze for Suffix
impl RefUnwindSafe for Suffix
impl Send for Suffix
impl Sync for Suffix
impl Unpin for Suffix
impl UnwindSafe for Suffix
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