pub struct Japanese { /* private fields */ }Expand description
The Japanese Calendar (with modern eras only)
The Japanese Calendar is a variant of the Gregorian calendar
created by the Japanese government. It is identical to the Gregorian calendar except that
is uses Japanese eras instead of the Common Era.
This implementation extends proleptically for dates before the calendar’s creation in 6 Meiji (1873 CE). The Meiji era is used proleptically back to and including 1868-10-23, Gregorian eras are used before that.
For a variant that uses approximations of historical Japanese eras proleptically, check out JapaneseExtended.
This corresponds to the "japanese" CLDR calendar.
§Era codes
This calendar currently supports seven era codes. It supports the five eras since its
introduction (meiji, taisho, showa, heisei, reiwa), as well as the Gregorian
bce (alias bc), and ce (alias ad) for earlier dates.
Future eras will also be added to this type when they are decided.
These eras are loaded from data, requiring a data provider capable of providing CalendarJapaneseModernV1
data.
Implementations§
Source§impl Japanese
impl Japanese
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new Japanese using only modern eras (post-meiji) from compiled data.
✨ Enabled with the compiled_data Cargo feature.
Sourcepub fn try_new_with_buffer_provider(
provider: &(impl BufferProvider + ?Sized),
) -> Result<Self, DataError>
pub fn try_new_with_buffer_provider( provider: &(impl BufferProvider + ?Sized), ) -> Result<Self, DataError>
A version of [Self :: new] that uses custom data provided by a BufferProvider.
✨ Enabled with the serde feature.
Sourcepub fn try_new_unstable<D: DataProvider<CalendarJapaneseModernV1> + ?Sized>(
provider: &D,
) -> Result<Self, DataError>
pub fn try_new_unstable<D: DataProvider<CalendarJapaneseModernV1> + ?Sized>( provider: &D, ) -> Result<Self, DataError>
A version of Self::new that uses custom data provided by a DataProvider.
Trait Implementations§
Source§impl Calendar for Japanese
impl Calendar for Japanese
Source§type DifferenceError = Infallible
type DifferenceError = Infallible
untilSource§fn from_codes(
&self,
era: Option<&str>,
year: i32,
month_code: MonthCode,
day: u8,
) -> Result<Self::DateInner, DateError>
fn from_codes( &self, era: Option<&str>, year: i32, month_code: MonthCode, day: u8, ) -> Result<Self::DateInner, DateError>
Source§fn has_cheap_iso_conversion(&self) -> bool
fn has_cheap_iso_conversion(&self) -> bool
from_iso/to_iso is more efficient
than from_rata_die/to_rata_die.Source§fn from_iso(&self, iso: IsoDateInner) -> Self::DateInner
fn from_iso(&self, iso: IsoDateInner) -> Self::DateInner
Source§fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner
fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner
Source§fn months_in_year(&self, date: &Self::DateInner) -> u8
fn months_in_year(&self, date: &Self::DateInner) -> u8
Source§fn days_in_year(&self, date: &Self::DateInner) -> u16
fn days_in_year(&self, date: &Self::DateInner) -> u16
Source§fn days_in_month(&self, date: &Self::DateInner) -> u8
fn days_in_month(&self, date: &Self::DateInner) -> u8
Source§fn is_in_leap_year(&self, date: &Self::DateInner) -> bool
fn is_in_leap_year(&self, date: &Self::DateInner) -> bool
Source§fn month(&self, date: &Self::DateInner) -> MonthInfo
fn month(&self, date: &Self::DateInner) -> MonthInfo
dateSource§fn day_of_month(&self, date: &Self::DateInner) -> DayOfMonth
fn day_of_month(&self, date: &Self::DateInner) -> DayOfMonth
dateSource§fn day_of_year(&self, date: &Self::DateInner) -> DayOfYear
fn day_of_year(&self, date: &Self::DateInner) -> DayOfYear
Source§fn debug_name(&self) -> &'static str
fn debug_name(&self) -> &'static str
Source§fn calendar_algorithm(&self) -> Option<CalendarAlgorithm>
fn calendar_algorithm(&self) -> Option<CalendarAlgorithm>
CalendarAlgorithm that is required to match
when parsing into this calendar. Read moreSource§fn extended_year(&self, date: &Self::DateInner) -> i32
fn extended_year(&self, date: &Self::DateInner) -> i32
Source§impl From<Japanese> for AnyCalendar
impl From<Japanese> for AnyCalendar
Source§fn from(value: Japanese) -> AnyCalendar
fn from(value: Japanese) -> AnyCalendar
Source§impl IntoAnyCalendar for Japanese
impl IntoAnyCalendar for Japanese
Source§fn to_any(self) -> AnyCalendar
fn to_any(self) -> AnyCalendar
AnyCalendar, moving it Read moreSource§fn kind(&self) -> AnyCalendarKind
fn kind(&self) -> AnyCalendarKind
AnyCalendarKind enum variant associated with this calendarSource§fn from_any(any: AnyCalendar) -> Result<Self, AnyCalendar>
fn from_any(any: AnyCalendar) -> Result<Self, AnyCalendar>
Source§fn from_any_ref(any: &AnyCalendar) -> Option<&Self>
fn from_any_ref(any: &AnyCalendar) -> Option<&Self>
Source§fn date_to_any(&self, d: &Self::DateInner) -> AnyDateInner
fn date_to_any(&self, d: &Self::DateInner) -> AnyDateInner
AnyDateInner Read moreAuto Trait Implementations§
impl Freeze for Japanese
impl RefUnwindSafe for Japanese
impl !Send for Japanese
impl !Sync for Japanese
impl Unpin for Japanese
impl UnwindSafe for Japanese
Blanket Implementations§
Source§impl<C> AsCalendar for Cwhere
C: Calendar,
impl<C> AsCalendar for Cwhere
C: Calendar,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more