Struct personify::PersonaData[][src]

pub struct PersonaData {
    pub model: ModelType,
    pub date: NaiveDate,
    pub personality: [char; 2],
    pub manufacture_no: u16,
}

A struct with the parsed data of a Persona ID.

Persona data can be parsed from a string using their std::str::FromStr implementation, like so:

let v = "A-223-0-QZ-029";
assert_eq!(
    v.parse::<PersonaData>().unwrap(),
    PersonaData {
        model: MT::Alpha,
        date: chrono::NaiveDate::from_ymd(2223, 1, 1),
        personality: "QZ".into(),
        manufacture_no: 29,
    }
);

They can also be re-stringified using std::fmt::Display.

assert_eq!(
    format!(
        "{}",
        PersonaData {
            model: MT::Alpha,
            date: chrono::NaiveDate::from_ymd(2223, 1, 1),
            personality: "QZ".into(),
            manufacture_no: 29,
        }
    ),
    "A-223-0-QZ-029"
);

Fields

model: ModelTypedate: NaiveDatepersonality: [char; 2]manufacture_no: u16

Trait Implementations

impl Debug for PersonaData[src]

impl Display for PersonaData[src]

impl Eq for PersonaData[src]

impl FromStr for PersonaData[src]

type Err = ParseFailure

The associated error which can be returned from parsing.

impl PartialEq<PersonaData> for PersonaData[src]

impl StructuralEq for PersonaData[src]

impl StructuralPartialEq for PersonaData[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.