Struct icu_calendar::cal::JapaneseExtended
source · pub struct JapaneseExtended(/* private fields */);
Expand description
The Japanese Calendar (with historical eras)
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 type can be used with Date
or DateTime
to represent dates in this calendar.
§Era codes
This calendar supports a large number of era codes. It supports the five post-Meiji eras
("meiji"
, "taisho"
, "showa"
, "heisei"
, "reiwa"
). Pre-Meiji 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"
and "ce"
eras
are used for dates before the first known era era.
These eras are loaded from data, requiring a data provider capable of providing JapaneseExtendedErasV1Marker
data (calendar/japanext@1
).
Implementations§
source§impl JapaneseExtended
impl JapaneseExtended
sourcepub const fn new() -> Self
pub const fn new() -> Self
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_any_provider(
provider: &(impl AnyProvider + ?Sized),
) -> Result<Self, DataError>
pub fn try_new_with_any_provider( provider: &(impl AnyProvider + ?Sized), ) -> Result<Self, 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<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<JapaneseExtendedErasV1Marker> + ?Sized>(
provider: &D,
) -> Result<Self, DataError>
pub fn try_new_unstable<D: DataProvider<JapaneseExtendedErasV1Marker> + ?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 JapaneseExtended
impl Calendar for JapaneseExtended
source§fn month(&self, date: &Self::DateInner) -> MonthInfo
fn month(&self, date: &Self::DateInner) -> MonthInfo
The calendar-specific month represented by date
source§fn day_of_month(&self, date: &Self::DateInner) -> DayOfMonth
fn day_of_month(&self, date: &Self::DateInner) -> DayOfMonth
The calendar-specific day-of-month represented by date
source§fn day_of_year_info(&self, date: &Self::DateInner) -> DayOfYearInfo
fn day_of_year_info(&self, date: &Self::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<Self::DateInner, DateError>
fn date_from_codes( &self, era: Option<Era>, year: i32, month_code: MonthCode, day: u8, ) -> Result<Self::DateInner, DateError>
source§fn date_from_iso(&self, iso: Date<Iso>) -> JapaneseDateInner
fn date_from_iso(&self, iso: Date<Iso>) -> JapaneseDateInner
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 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 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 to_any_cloned(&self) -> AnyCalendar
fn to_any_cloned(&self) -> AnyCalendar
AnyCalendar
, cloning it Read moresource§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 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§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