pub struct Japanese { /* private fields */ }
Expand description
The Japanese Calendar (with modern eras only)
The Japanese calendar is a solar calendar used in Japan, with twelve months. The months and days are identical to that of the Gregorian calendar, however the years are counted differently using the Japanese era system.
This calendar only contains eras after Meiji, for all historical eras, check out JapaneseExtended
.
This type can be used with Date
to represent dates in this calendar.
§Era codes
This calendar currently supports seven era codes. It supports the five post-Meiji eras
(meiji
, taisho
, showa
, heisei
, reiwa
), as well as using the Gregorian
bce
(alias bc
), and ce
(alias ad
) for dates before the Meiji era.
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.
§Month codes
This calendar supports 12 solar month codes (M01
- M12
)
Implementations§
Source§impl Japanese
impl Japanese
Sourcepub const fn new() -> Japanese
pub const fn new() -> Japanese
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<Japanese, DataError>
pub fn try_new_with_buffer_provider( provider: &(impl BufferProvider + ?Sized), ) -> Result<Japanese, 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<Japanese, DataError>
pub fn try_new_unstable<D>(provider: &D) -> Result<Japanese, 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§fn month(&self, date: &<Japanese as Calendar>::DateInner) -> MonthInfo
fn month(&self, date: &<Japanese as Calendar>::DateInner) -> MonthInfo
The calendar-specific month represented by date
Source§fn day_of_month(&self, date: &<Japanese as Calendar>::DateInner) -> DayOfMonth
fn day_of_month(&self, date: &<Japanese as Calendar>::DateInner) -> DayOfMonth
The calendar-specific day-of-month represented by date
Source§fn from_codes(
&self,
era: Option<&str>,
year: i32,
month_code: MonthCode,
day: u8,
) -> Result<<Japanese as Calendar>::DateInner, DateError>
fn from_codes( &self, era: Option<&str>, year: i32, month_code: MonthCode, day: u8, ) -> Result<<Japanese as Calendar>::DateInner, DateError>
Source§fn from_rata_die(&self, rd: RataDie) -> <Japanese as Calendar>::DateInner
fn from_rata_die(&self, rd: RataDie) -> <Japanese as Calendar>::DateInner
RataDie
Source§fn to_rata_die(&self, date: &<Japanese as Calendar>::DateInner) -> RataDie
fn to_rata_die(&self, date: &<Japanese as Calendar>::DateInner) -> RataDie
RataDie
from this dateSource§fn from_iso(&self, iso: IsoDateInner) -> JapaneseDateInner
fn from_iso(&self, iso: IsoDateInner) -> JapaneseDateInner
Source§fn to_iso(&self, date: &<Japanese as Calendar>::DateInner) -> IsoDateInner
fn to_iso(&self, date: &<Japanese as Calendar>::DateInner) -> IsoDateInner
Source§fn months_in_year(&self, date: &<Japanese as Calendar>::DateInner) -> u8
fn months_in_year(&self, date: &<Japanese as Calendar>::DateInner) -> u8
Source§fn days_in_year(&self, date: &<Japanese as Calendar>::DateInner) -> u16
fn days_in_year(&self, date: &<Japanese as Calendar>::DateInner) -> u16
Source§fn days_in_month(&self, date: &<Japanese as Calendar>::DateInner) -> u8
fn days_in_month(&self, date: &<Japanese as Calendar>::DateInner) -> u8
Source§fn year_info(
&self,
date: &<Japanese as Calendar>::DateInner,
) -> <Japanese as Calendar>::Year
fn year_info( &self, date: &<Japanese as Calendar>::DateInner, ) -> <Japanese as Calendar>::Year
Source§fn extended_year(&self, date: &<Japanese as Calendar>::DateInner) -> i32
fn extended_year(&self, date: &<Japanese as Calendar>::DateInner) -> i32
Source§fn is_in_leap_year(&self, date: &<Japanese as Calendar>::DateInner) -> bool
fn is_in_leap_year(&self, date: &<Japanese as Calendar>::DateInner) -> bool
Source§fn day_of_year(&self, date: &<Japanese as Calendar>::DateInner) -> DayOfYear
fn day_of_year(&self, date: &<Japanese 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§impl CldrCalendar for Japanese
impl CldrCalendar for Japanese
Source§type YearNamesV1 = DatetimeNamesYearJapaneseV1
type YearNamesV1 = DatetimeNamesYearJapaneseV1
Source§type MonthNamesV1 = DatetimeNamesMonthJapaneseV1
type MonthNamesV1 = DatetimeNamesMonthJapaneseV1
Source§type SkeletaV1 = DatetimePatternsDateJapaneseV1
type SkeletaV1 = DatetimePatternsDateJapaneseV1
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<Japanese, AnyCalendar>
fn from_any(any: AnyCalendar) -> Result<Japanese, AnyCalendar>
Source§fn from_any_ref(any: &AnyCalendar) -> Option<&Japanese>
fn from_any_ref(any: &AnyCalendar) -> Option<&Japanese>
impl IntoFormattableAnyCalendar for Japanese
impl UnstableSealed for Japanese
impl UnstableSealed for Japanese
Auto 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