pub struct Rg { /* private fields */ }Expand description
A validated RG stored as ASCII bytes (digits, plus optional trailing 'X'
for SP), tagged with its issuing UF.
Implementations§
Source§impl Rg
impl Rg
Sourcepub fn formatted(&self) -> String
pub fn formatted(&self) -> String
Formatted per the UF mask. For UFs without a known mask, returns the unformatted body.
Sourcepub fn masked(&self) -> String
pub fn masked(&self) -> String
Masked representation — shows the first 2 digits and masks the rest.
SP: "294653272" → "29.***.***-*" (formatted with separators).
Other UFs: "1234567" → "12*****" (no separators).
Sourcepub fn body(&self) -> &str
pub fn body(&self) -> &str
Body without the check digit.
SP: returns the 8-digit base (without DV).
Other UFs: returns as_str() (no DV is identifiable).
Sourcepub fn check_digit(&self) -> Option<u8>
pub fn check_digit(&self) -> Option<u8>
Check digit when the UF has a verified algorithm. Some(0..=9) for
digits, Some(10) for the SP 'X' terminator, None otherwise.
Trait Implementations§
impl Copy for Rg
impl Eq for Rg
impl StructuralPartialEq for Rg
Auto Trait Implementations§
impl Freeze for Rg
impl RefUnwindSafe for Rg
impl Send for Rg
impl Sync for Rg
impl Unpin for Rg
impl UnsafeUnpin for Rg
impl UnwindSafe for Rg
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