Struct icu_calendar::provider::islamic::PackedIslamicYearInfo
source ยท #[repr(C, packed(1))]pub struct PackedIslamicYearInfo(pub u8, pub u8);
Expand description
The struct containing compiled Islamic YearInfo
Bit structure (little endian: note that shifts go in the opposite direction!)
Bit: 0 1 2 3 4 5 6 7
Byte 0: [ month lengths .............
Byte 1: .. months ] | [ ny offset ]
Where the New Year Offset is a signed offset from epoch + MEAN_SYNODIC_MONTH * year * 12
for the given
calendar. This number does not appear to be less than 2, however we use all remaining bits for it in case of drift
in the math.
The month lengths are stored as 1 = 30, 0 = 29 for each month including the leap month.
๐ง This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
including in SemVer minor releases. While the serde representation of data structs is guaranteed
to be stable, their Rust representation might not be. Use with caution.
Tuple Fieldsยง
ยง0: u8
ยง1: u8
Implementationsยง
sourceยงimpl PackedIslamicYearInfo
impl PackedIslamicYearInfo
pub(crate) fn new(month_lengths: [bool; 12], ny_offset: i8) -> Self
fn month_lengths(self) -> [u8; 12]
pub(crate) fn ny_offset(self) -> i8
pub(crate) fn ny<IB: IslamicBasedMarker>(self, extended_year: i32) -> RataDie
pub(crate) fn month_has_30_days(self, month: u8) -> bool
sourcepub(crate) fn days_in_month(self, month: u8) -> u8
pub(crate) fn days_in_month(self, month: u8) -> u8
The number of days in a given 1-indexed month
pub(crate) fn last_day_of_month(self, month: u8) -> u16
pub(crate) fn days_in_year(self) -> u16
pub(crate) fn compute_with_ny<IB: IslamicBasedMarker>( extended_year: i32, ny: RataDie, ) -> Self
Trait Implementationsยง
sourceยงimpl AsULE for PackedIslamicYearInfo
impl AsULE for PackedIslamicYearInfo
sourceยงtype ULE = PackedIslamicYearInfo
type ULE = PackedIslamicYearInfo
The ULE type corresponding to
Self
. Read moresourceยงfn to_unaligned(self) -> Self
fn to_unaligned(self) -> Self
sourceยงfn from_unaligned(other: Self) -> Self
fn from_unaligned(other: Self) -> Self
sourceยงimpl Clone for PackedIslamicYearInfo
impl Clone for PackedIslamicYearInfo
sourceยงfn clone(&self) -> PackedIslamicYearInfo
fn clone(&self) -> PackedIslamicYearInfo
Returns a copy of the value. Read more
1.0.0 ยท sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceยงimpl Debug for PackedIslamicYearInfo
impl Debug for PackedIslamicYearInfo
sourceยงimpl Hash for PackedIslamicYearInfo
impl Hash for PackedIslamicYearInfo
sourceยงimpl Ord for PackedIslamicYearInfo
impl Ord for PackedIslamicYearInfo
sourceยงfn cmp(&self, other: &PackedIslamicYearInfo) -> Ordering
fn cmp(&self, other: &PackedIslamicYearInfo) -> Ordering
1.21.0 ยท sourceยงfn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
sourceยงimpl PartialEq for PackedIslamicYearInfo
impl PartialEq for PackedIslamicYearInfo
sourceยงimpl PartialOrd for PackedIslamicYearInfo
impl PartialOrd for PackedIslamicYearInfo
sourceยงimpl ULE for PackedIslamicYearInfo
impl ULE for PackedIslamicYearInfo
sourceยงfn validate_byte_slice(bytes: &[u8]) -> Result<(), ZeroVecError>
fn validate_byte_slice(bytes: &[u8]) -> Result<(), ZeroVecError>
Validates a byte slice,
&[u8]
. Read moresourceยงfn parse_byte_slice(bytes: &[u8]) -> Result<&[Self], ZeroVecError>
fn parse_byte_slice(bytes: &[u8]) -> Result<&[Self], ZeroVecError>
sourceยงunsafe fn from_byte_slice_unchecked(bytes: &[u8]) -> &[Self]
unsafe fn from_byte_slice_unchecked(bytes: &[u8]) -> &[Self]
Takes a byte slice,
&[u8]
, and return it as &[Self]
with the same lifetime, assuming
that this byte slice has previously been run through Self::parse_byte_slice()
with
success. Read moreimpl Copy for PackedIslamicYearInfo
impl Eq for PackedIslamicYearInfo
impl StructuralPartialEq for PackedIslamicYearInfo
Auto Trait Implementationsยง
impl Freeze for PackedIslamicYearInfo
impl RefUnwindSafe for PackedIslamicYearInfo
impl Send for PackedIslamicYearInfo
impl Sync for PackedIslamicYearInfo
impl Unpin for PackedIslamicYearInfo
impl UnwindSafe for PackedIslamicYearInfo
Blanket Implementationsยง
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
Mutably borrows from an owned value. Read more
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)
๐ฌThis is a nightly-only experimental API. (
clone_to_uninit
)