MonthGrid

Struct MonthGrid 

Source
pub struct MonthGrid {
    pub year: i32,
    pub month: u32,
    pub days: u32,
    pub first_weekday: u32,
    pub grid: [[Option<u32>; 7]; 6],
}
Expand description

A 6×7 grid representing a single Shahanshahi calendar month.

Rows are weeks, columns are weekdays starting from Saturday (column 0) through Friday (column 6), following the Iranian week convention. Each cell is None for empty positions or Some(day) for a valid day.

Fields§

§year: i32

Shahanshahi year (e.g. 2584).

§month: u32

Persian month (1–12).

§days: u32

Total number of days in this month.

§first_weekday: u32

Weekday index of the 1st day (0=Saturday, 6=Friday).

§grid: [[Option<u32>; 7]; 6]

The grid: 6 rows × 7 columns. None = empty cell, Some(day) = day number.

Implementations§

Source§

impl MonthGrid

Source

pub fn new(year: i32, month: u32) -> Self

Build a new month grid for the given Shahanshahi year and month.

Source

pub fn row_count(&self) -> usize

Number of rows actually used in the grid (between 4 and 6).

Source

pub fn day_of_year(&self, day: u32) -> u32

Get day-of-year (1–366) for a given day in this month.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.