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
or DateTime
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"
and "ce"
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 JapaneseErasV1Marker
data (calendar/japanese@1
).
§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_any_provider(
provider: &(impl AnyProvider + ?Sized),
) -> Result<Japanese, DataError>
pub fn try_new_with_any_provider( provider: &(impl AnyProvider + ?Sized), ) -> Result<Japanese, DataError>
A version of [Self :: new
] that uses custom data provided by an AnyProvider
.
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 day_of_year_info(
&self,
date: &<Japanese as Calendar>::DateInner,
) -> DayOfYearInfo
fn day_of_year_info( &self, date: &<Japanese as Calendar>::DateInner, ) -> DayOfYearInfo
Information of the day of the year
source§fn date_from_codes(
&self,
era: Option<Era>,
year: i32,
month_code: MonthCode,
day: u8,
) -> Result<<Japanese as Calendar>::DateInner, DateError>
fn date_from_codes( &self, era: Option<Era>, year: i32, month_code: MonthCode, day: u8, ) -> Result<<Japanese as Calendar>::DateInner, DateError>
source§fn date_from_iso(&self, iso: Date<Iso>) -> JapaneseDateInner
fn date_from_iso(&self, iso: Date<Iso>) -> JapaneseDateInner
source§fn date_to_iso(&self, date: &<Japanese as Calendar>::DateInner) -> Date<Iso>
fn date_to_iso(&self, date: &<Japanese as Calendar>::DateInner) -> Date<Iso>
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(&self, date: &<Japanese as Calendar>::DateInner) -> YearInfo
fn year(&self, date: &<Japanese as Calendar>::DateInner) -> YearInfo
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 debug_name(&self) -> &'static str
fn debug_name(&self) -> &'static str
source§fn any_calendar_kind(&self) -> Option<AnyCalendarKind>
fn any_calendar_kind(&self) -> Option<AnyCalendarKind>
AnyCalendarKind
corresponding to this calendar,
if one exists. Implementors outside of icu::calendar
should return None
source§fn day_of_week(&self, date: &Self::DateInner) -> IsoWeekday
fn day_of_week(&self, date: &Self::DateInner) -> IsoWeekday
source§impl CldrCalendar for Japanese
impl CldrCalendar for Japanese
source§type YearNamesV1Marker = JapaneseYearNamesV1Marker
type YearNamesV1Marker = JapaneseYearNamesV1Marker
source§type MonthNamesV1Marker = JapaneseMonthNamesV1Marker
type MonthNamesV1Marker = JapaneseMonthNamesV1Marker
source§type SkeletaV1Marker = JapaneseDateNeoSkeletonPatternsV1Marker
type SkeletaV1Marker = JapaneseDateNeoSkeletonPatternsV1Marker
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 to_any_cloned(&self) -> AnyCalendar
fn to_any_cloned(&self) -> AnyCalendar
AnyCalendar
, cloning it Read moresource§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>
source§fn date_to_any(&self, d: &<Japanese as Calendar>::DateInner) -> AnyDateInner
fn date_to_any(&self, d: &<Japanese as Calendar>::DateInner) -> AnyDateInner
AnyDateInner
Read moreimpl 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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