[−][src]Struct koyomi::Era
元号
https://ja.wikipedia.org/wiki/元号
Methods
impl Era
[src]
pub fn name(&self) -> String
[src]
元号名を返す
Examples
use koyomi::{Date, era}; let date = Date::from_ymd(2018, 1, 1).unwrap(); let e = era(&date).unwrap(); assert_eq!(e.name(), "平成");
pub fn year(&self) -> i32
[src]
元号に基づいた「年」を返す
Examples
use koyomi::{Date, era}; let date = Date::from_ymd(2018, 1, 1).unwrap(); let e = era(&date).unwrap(); assert_eq!(e.year(), 30);
pub fn format(&self) -> String
[src]
元号の文字列表現を返す 初年度は「1年」ではなく「元年」
Examples
use koyomi::{Date, era}; let date = Date::from_ymd(2018, 1, 1).unwrap(); let e = era(&date).unwrap(); assert_eq!(e.format(), "平成30年"); let date = Date::from_ymd(1989, 1, 10).unwrap(); let e = era(&date).unwrap(); assert_eq!(e.format(), "平成元年");
Trait Implementations
impl Debug for Era
[src]
impl Eq for Era
[src]
impl PartialEq<Era> for Era
[src]
impl StructuralEq for Era
[src]
impl StructuralPartialEq for Era
[src]
Auto Trait Implementations
impl RefUnwindSafe for Era
impl Send for Era
impl Sync for Era
impl Unpin for Era
impl UnwindSafe for Era
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,