pub struct JapaneseExtended(/* private fields */);Expand description
The Japanese Calendar (with historical eras)
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). This implementation uses approximations of earlier Japanese eras proleptically and uses the Gregorian eras for even earlier dates that don’t have an approximate Japanese era.
For a variant whose Japanese eras start with Meiji, check out Japanese.
This corresponds to the "japanext" CLDR calendar.
§Era codes
This calendar supports a large number of era codes. It supports the five eras since its introduction
(meiji, taisho, showa, heisei, reiwa). Proleptic eras are represented
with their names converted to lowercase ASCII and followed by their start year. E.g. the Ten’ō
era (781 - 782 CE) has the code teno-781. The Gregorian bce (alias bc), and ce (alias ad)
are used for dates before the first known era era.
These eras are loaded from data, requiring a data provider capable of providing CalendarJapaneseExtendedV1
data.
Implementations§
Source§impl JapaneseExtended
impl JapaneseExtended
Sourcepub const fn new() -> JapaneseExtended
pub const fn new() -> JapaneseExtended
Creates a new Japanese from using all eras (including pre-meiji) from compiled data.
✨ Enabled with the compiled_data Cargo feature.
Sourcepub fn try_new_with_buffer_provider(
provider: &(impl BufferProvider + ?Sized),
) -> Result<JapaneseExtended, DataError>
pub fn try_new_with_buffer_provider( provider: &(impl BufferProvider + ?Sized), ) -> Result<JapaneseExtended, 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>(provider: &D) -> Result<JapaneseExtended, DataError>
pub fn try_new_unstable<D>(provider: &D) -> Result<JapaneseExtended, DataError>
A version of Self::new that uses custom data provided by a DataProvider.
Trait Implementations§
Source§impl Calendar for JapaneseExtended
impl Calendar for JapaneseExtended
Source§type DateInner = JapaneseExtendedDateInner
type DateInner = JapaneseExtendedDateInner
Source§type DifferenceError = Infallible
type DifferenceError = Infallible
untilSource§fn from_codes(
&self,
era: Option<&str>,
year: i32,
month_code: MonthCode,
day: u8,
) -> Result<<JapaneseExtended as Calendar>::DateInner, DateError>
fn from_codes( &self, era: Option<&str>, year: i32, month_code: MonthCode, day: u8, ) -> Result<<JapaneseExtended as Calendar>::DateInner, DateError>
Source§fn from_rata_die(
&self,
rd: RataDie,
) -> <JapaneseExtended as Calendar>::DateInner
fn from_rata_die( &self, rd: RataDie, ) -> <JapaneseExtended as Calendar>::DateInner
RataDieSource§fn to_rata_die(
&self,
date: &<JapaneseExtended as Calendar>::DateInner,
) -> RataDie
fn to_rata_die( &self, date: &<JapaneseExtended as Calendar>::DateInner, ) -> RataDie
RataDie from this dateSource§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,
) -> <JapaneseExtended as Calendar>::DateInner
fn from_iso( &self, iso: IsoDateInner, ) -> <JapaneseExtended as Calendar>::DateInner
Source§fn to_iso(
&self,
date: &<JapaneseExtended as Calendar>::DateInner,
) -> IsoDateInner
fn to_iso( &self, date: &<JapaneseExtended as Calendar>::DateInner, ) -> IsoDateInner
Source§fn months_in_year(&self, date: &<JapaneseExtended as Calendar>::DateInner) -> u8
fn months_in_year(&self, date: &<JapaneseExtended as Calendar>::DateInner) -> u8
Source§fn days_in_year(&self, date: &<JapaneseExtended as Calendar>::DateInner) -> u16
fn days_in_year(&self, date: &<JapaneseExtended as Calendar>::DateInner) -> u16
Source§fn days_in_month(&self, date: &<JapaneseExtended as Calendar>::DateInner) -> u8
fn days_in_month(&self, date: &<JapaneseExtended as Calendar>::DateInner) -> u8
Source§fn year_info(
&self,
date: &<JapaneseExtended as Calendar>::DateInner,
) -> <JapaneseExtended as Calendar>::Year
fn year_info( &self, date: &<JapaneseExtended as Calendar>::DateInner, ) -> <JapaneseExtended as Calendar>::Year
Source§fn is_in_leap_year(
&self,
date: &<JapaneseExtended as Calendar>::DateInner,
) -> bool
fn is_in_leap_year( &self, date: &<JapaneseExtended as Calendar>::DateInner, ) -> bool
Source§fn month(&self, date: &<JapaneseExtended as Calendar>::DateInner) -> MonthInfo
fn month(&self, date: &<JapaneseExtended as Calendar>::DateInner) -> MonthInfo
dateSource§fn day_of_month(
&self,
date: &<JapaneseExtended as Calendar>::DateInner,
) -> DayOfMonth
fn day_of_month( &self, date: &<JapaneseExtended as Calendar>::DateInner, ) -> DayOfMonth
dateSource§fn day_of_year(
&self,
date: &<JapaneseExtended as Calendar>::DateInner,
) -> DayOfYear
fn day_of_year( &self, date: &<JapaneseExtended as Calendar>::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 CldrCalendar for JapaneseExtended
impl CldrCalendar for JapaneseExtended
Source§type YearNamesV1 = DatetimeNamesYearJapanextV1
type YearNamesV1 = DatetimeNamesYearJapanextV1
Source§type MonthNamesV1 = DatetimeNamesMonthJapanextV1
type MonthNamesV1 = DatetimeNamesMonthJapanextV1
Source§type SkeletaV1 = DatetimePatternsDateJapanextV1
type SkeletaV1 = DatetimePatternsDateJapanextV1
Source§impl Clone for JapaneseExtended
impl Clone for JapaneseExtended
Source§fn clone(&self) -> JapaneseExtended
fn clone(&self) -> JapaneseExtended
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for JapaneseExtended
impl Debug for JapaneseExtended
Source§impl Default for JapaneseExtended
impl Default for JapaneseExtended
Source§fn default() -> JapaneseExtended
fn default() -> JapaneseExtended
Source§impl From<JapaneseExtended> for AnyCalendar
impl From<JapaneseExtended> for AnyCalendar
Source§fn from(value: JapaneseExtended) -> AnyCalendar
fn from(value: JapaneseExtended) -> AnyCalendar
Source§impl IntoAnyCalendar for JapaneseExtended
impl IntoAnyCalendar for JapaneseExtended
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<JapaneseExtended, AnyCalendar>
fn from_any(any: AnyCalendar) -> Result<JapaneseExtended, AnyCalendar>
Source§fn from_any_ref(any: &AnyCalendar) -> Option<&JapaneseExtended>
fn from_any_ref(any: &AnyCalendar) -> Option<&JapaneseExtended>
Source§fn date_to_any(
&self,
d: &<JapaneseExtended as Calendar>::DateInner,
) -> AnyDateInner
fn date_to_any( &self, d: &<JapaneseExtended as Calendar>::DateInner, ) -> AnyDateInner
AnyDateInner Read moreimpl UnstableSealed for JapaneseExtended
Auto Trait Implementations§
impl Freeze for JapaneseExtended
impl RefUnwindSafe for JapaneseExtended
impl !Send for JapaneseExtended
impl !Sync for JapaneseExtended
impl Unpin for JapaneseExtended
impl UnwindSafe for JapaneseExtended
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