pub struct NHSNumber {
pub digits: [i8; 10],
}Expand description
NHS Number is a unique identifier for patients in the National Health Service of England, Wales, and the Isle of Man.
Reference:
Fields§
§digits: [i8; 10]Implementations§
Source§impl NHSNumber
impl NHSNumber
Sourcepub fn new(digits: [i8; 10]) -> Self
pub fn new(digits: [i8; 10]) -> Self
Create a new NHS Number instance with the provided digits.
pub fn check_digit(&self) -> i8
pub fn calculate_check_digit(&self) -> i8
Sourcepub fn validate_check_digit(&self) -> bool
pub fn validate_check_digit(&self) -> bool
Validate the NHS Number check digit equals the calculated check digit.
Sourcepub fn testable_random_sample() -> NHSNumber
pub fn testable_random_sample() -> NHSNumber
Validate the NHS Number check digit equals the calculated check digit.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for NHSNumber
impl<'de> Deserialize<'de> for NHSNumber
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for NHSNumber
Format the NHS Number is a 10-digit number with spaces:
impl Display for NHSNumber
Format the NHS Number is a 10-digit number with spaces:
- 3 digits
- space
- 3 digits
- space
- 4 digits
Source§impl FromStr for NHSNumber
Implement the FromStr trait for NHSNumber to allow parsing from a string.
impl FromStr for NHSNumber
Implement the FromStr trait for NHSNumber to allow parsing from a string.
This parser allows for optional spcae separators in the NHS Number string, so long as the space separators are in their expected positions.
Source§impl Ord for NHSNumber
impl Ord for NHSNumber
Source§impl PartialOrd for NHSNumber
impl PartialOrd for NHSNumber
impl Copy for NHSNumber
impl Eq for NHSNumber
impl StructuralPartialEq for NHSNumber
Auto Trait Implementations§
impl Freeze for NHSNumber
impl RefUnwindSafe for NHSNumber
impl Send for NHSNumber
impl Sync for NHSNumber
impl Unpin for NHSNumber
impl UnwindSafe for NHSNumber
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