pub struct ShiftInfo {
pub date: NaiveDate,
pub day_of_cycle: u32,
pub cycle_index: u32,
pub shift_type: ShiftType,
}Expand description
Result of querying what shift falls on a given date.
Returned by get_shift_info.
§Fields
| Field | Type | Range | Description |
|---|---|---|---|
date | NaiveDate | — | The queried date |
day_of_cycle | u32 | 1..=cycle_length | Which day in the cycle (1-based) |
cycle_index | u32 | 0..=cycle_length-1 | Zero-based index into the cycle array |
shift_type | ShiftType | — | The shift type for this date |
use shift_algorithm::cycle::default_config;
use shift_algorithm::get_shift_info;
let config = default_config();
let info = get_shift_info(config.reference_date, &config, 0);
assert_eq!(info.day_of_cycle, 1);
assert_eq!(info.cycle_index, 0);Fields§
§date: NaiveDateThe queried date.
day_of_cycle: u32Day index within the cycle (1-based, 1..=cycle_length).
cycle_index: u32Zero-based index into the cycle array (0..=cycle_length-1).
shift_type: ShiftTypeThe shift type for this date.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ShiftInfo
impl<'de> Deserialize<'de> for ShiftInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ShiftInfo
impl RefUnwindSafe for ShiftInfo
impl Send for ShiftInfo
impl Sync for ShiftInfo
impl Unpin for ShiftInfo
impl UnsafeUnpin for ShiftInfo
impl UnwindSafe for ShiftInfo
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