pub struct ScriptDate {
pub year: u16,
pub month: u8,
pub day: u8,
}
Expand description
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.
Implementations§
Source§impl ScriptDate
impl ScriptDate
Sourcepub const fn new(year: u16, month: u8, day: u8) -> Self
pub const fn new(year: u16, month: u8, day: u8) -> Self
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§
Source§impl Clone for ScriptDate
impl Clone for ScriptDate
Source§fn clone(&self) -> ScriptDate
fn clone(&self) -> ScriptDate
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ScriptDate
impl Debug for ScriptDate
Source§impl FromStr for ScriptDate
impl FromStr for ScriptDate
Source§impl Hash for ScriptDate
impl Hash for ScriptDate
Source§impl Ord for ScriptDate
impl Ord for ScriptDate
Source§fn cmp(&self, other: &ScriptDate) -> Ordering
fn cmp(&self, other: &ScriptDate) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ScriptDate
impl PartialEq for ScriptDate
Source§impl PartialOrd for ScriptDate
impl PartialOrd for ScriptDate
impl Copy for ScriptDate
impl Eq for ScriptDate
Auto Trait Implementations§
impl Freeze for ScriptDate
impl RefUnwindSafe for ScriptDate
impl Send for ScriptDate
impl Sync for ScriptDate
impl Unpin for ScriptDate
impl UnwindSafe for ScriptDate
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