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
).
Implementations§
source§impl Japanese
impl Japanese
sourcepub fn try_new_unstable<D>(data_provider: &D) -> Result<Japanese, CalendarError>where
D: DataProvider<JapaneseErasV1Marker> + ?Sized,
pub fn try_new_unstable<D>(data_provider: &D) -> Result<Japanese, CalendarError>where D: DataProvider<JapaneseErasV1Marker> + ?Sized,
Creates a new Japanese
from locale data using only modern eras (post-meiji).
sourcepub fn try_new_with_any_provider(
provider: &impl AnyProvider
) -> Result<Japanese, CalendarError>
pub fn try_new_with_any_provider( provider: &impl AnyProvider ) -> Result<Japanese, CalendarError>
Creates a new instance using an AnyProvider
.
For details on the behavior of this function, see: Self::try_new_unstable
sourcepub fn try_new_with_buffer_provider(
provider: &impl BufferProvider
) -> Result<Japanese, CalendarError>
pub fn try_new_with_buffer_provider( provider: &impl BufferProvider ) -> Result<Japanese, CalendarError>
✨ Enabled with the "serde"
feature.
Creates a new instance using a BufferProvider
.
For details on the behavior of this function, see: Self::try_new_unstable
Trait Implementations§
source§impl Calendar for Japanese
impl Calendar for Japanese
source§fn year(&self, date: &<Japanese as Calendar>::DateInner) -> FormattableYear
fn year(&self, date: &<Japanese as Calendar>::DateInner) -> FormattableYear
The calendar-specific year represented by date
source§fn month(&self, date: &<Japanese as Calendar>::DateInner) -> FormattableMonth
fn month(&self, date: &<Japanese as Calendar>::DateInner) -> FormattableMonth
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
§type DateInner = JapaneseDateInner
type DateInner = JapaneseDateInner
source§fn date_from_codes(
&self,
era: Era,
year: i32,
month_code: MonthCode,
day: u8
) -> Result<<Japanese as Calendar>::DateInner, CalendarError>
fn date_from_codes( &self, era: Era, year: i32, month_code: MonthCode, day: u8 ) -> Result<<Japanese as Calendar>::DateInner, CalendarError>
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) -> u32
fn days_in_year(&self, date: &<Japanese as Calendar>::DateInner) -> u32
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 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 Nonesource§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§const DEFAULT_BCP_47_IDENTIFIER: Value = {
const R: ::icu_locid::extensions::unicode::Value =
::icu_locid::extensions::unicode::Value::from_tinystr(match ::icu_locid::extensions::unicode::Value::subtag_from_bytes("japanese".as_bytes())
{
Ok(r) => r,
_ =>
::core::panicking::panic_fmt(<#[lang = "format_arguments"]>::new_const(&["Invalid Unicode extension value: japanese"])),
});
R
}
const DEFAULT_BCP_47_IDENTIFIER: Value = { const R: ::icu_locid::extensions::unicode::Value = ::icu_locid::extensions::unicode::Value::from_tinystr(match ::icu_locid::extensions::unicode::Value::subtag_from_bytes("japanese".as_bytes()) { Ok(r) => r, _ => ::core::panicking::panic_fmt(<#[lang = "format_arguments"]>::new_const(&["Invalid Unicode extension value: japanese"])), }); R }
§type DateSymbolsV1Marker = JapaneseDateSymbolsV1Marker
type DateSymbolsV1Marker = JapaneseDateSymbolsV1Marker
§type DateLengthsV1Marker = JapaneseDateLengthsV1Marker
type DateLengthsV1Marker = JapaneseDateLengthsV1Marker
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 to_any_cloned(&self) -> AnyCalendar
fn to_any_cloned(&self) -> AnyCalendar
AnyCalendar
, cloning it Read moresource§fn date_to_any(&self, d: &<Japanese as Calendar>::DateInner) -> AnyDateInner
fn date_to_any(&self, d: &<Japanese as Calendar>::DateInner) -> AnyDateInner
AnyDateInner
Read more