pub struct Trigraph(/* private fields */);Expand description
A 3-character country trigraph (e.g., USA, GBR, AUS). Validated against CVE country code list at rule-check time.
The inner bytes are private; construction goes through Trigraph::try_new
which enforces ASCII-uppercase invariants so that Trigraph::as_str can
return a &str infallibly without panicking at runtime.
Implementations§
Source§impl Trigraph
impl Trigraph
Sourcepub const fn try_new(bytes: [u8; 3]) -> Option<Trigraph>
pub const fn try_new(bytes: [u8; 3]) -> Option<Trigraph>
Attempt to construct a trigraph from 3 bytes.
Returns None unless every byte is an ASCII uppercase letter
(A–Z), which is the invariant enforced by CAPCO for all valid
country/entity codes.
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Return the trigraph as a string slice.
Infallible because construction via Trigraph::try_new (or the
Trigraph::USA constant) guarantees ASCII-uppercase bytes, which
are always valid UTF-8.
Trait Implementations§
impl Copy for Trigraph
impl Eq for Trigraph
impl StructuralPartialEq for Trigraph
Auto Trait Implementations§
impl Freeze for Trigraph
impl RefUnwindSafe for Trigraph
impl Send for Trigraph
impl Sync for Trigraph
impl Unpin for Trigraph
impl UnsafeUnpin for Trigraph
impl UnwindSafe for Trigraph
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