[][src]Struct iso15924::ScriptDate

pub struct ScriptDate {
    pub year: u16,
    pub month: u8,
    pub day: u8,
}

Representation of a date of introduction for a script code. This contains year, month, and day public fields of u16 type.

Examples

Create a new valid ScriptDate:

use iso15924::ScriptDate;

let _ = ScriptDate::new(1976, 7, 2);

Check if a ScriptDate is equal to, less than, etc. another ScriptDate:

use iso15924::ScriptDate;

let date1 = ScriptDate::new(1997, 7, 7);
let date2 = ScriptDate::new(2005, 5, 5);

// Check that `date1` is not equal to `date2`.
assert_ne!(date1, date2);

// Check that `date1` is less than `date2`.
assert!(date1 < date2);

// Check that `date2` is greater than `date1`.
assert!(date2 > date1);

Fields

year: u16

The year of the date that a code was introduced.

month: u8

The month of the date that a code was introduced.

day: u8

The day of the date that a code was introduced.

Methods

impl ScriptDate[src]

pub const fn new(year: u16, month: u8, day: u8) -> Self[src]

Creates a new ScriptDate from the given year, month, and day, if possible.

This doesn't check the input for a valid month and day. If you need that, use the TryFrom impl.

Examples

Create a new valid ScriptDate:

use iso15924::ScriptDate;

let _ = ScriptDate::new(2000, 1, 1);

Trait Implementations

impl Clone for ScriptDate[src]

impl Copy for ScriptDate[src]

impl Eq for ScriptDate[src]

impl Ord for ScriptDate[src]

impl PartialEq<ScriptDate> for ScriptDate[src]

impl PartialOrd<ScriptDate> for ScriptDate[src]

impl Debug for ScriptDate[src]

impl TryFrom<(u16, u8, u8)> for ScriptDate[src]

type Error = ScriptDateError

The type returned in the event of a conversion error.

impl FromStr for ScriptDate[src]

type Err = ScriptDateError

The associated error which can be returned from parsing.

impl Hash for ScriptDate[src]

Auto Trait Implementations

Blanket Implementations

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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

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

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