#[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