pub struct Daily { /* private fields */ }Expand description
A recurrence pattern for daily events which may also include fixed times of the day.
§Example
use recurring::pattern::Daily;
use jiff::civil::time;
let every_two_days_at_twelve = Daily::new(1).at(time(12, 0, 0, 0));Implementations§
Source§impl Daily
impl Daily
Sourcepub fn new<I: ToSpan>(interval: I) -> Daily
pub fn new<I: ToSpan>(interval: I) -> Daily
Creates a new Daily from an interval of days.
The fallible version of this method is Daily::try_new.
§Panics
Panics if interval is negative or zero.
§Example
use recurring::pattern::Daily;
let every_two_days = Daily::new(2);Sourcepub fn try_new<I: ToSpan>(interval: I) -> Result<Daily, Error>
pub fn try_new<I: ToSpan>(interval: I) -> Result<Daily, Error>
Creates a new Daily from an interval of days.
The panicking version of this method is Daily::new.
§Errors
Returns an Error if interval is negative or zero.
§Example
use recurring::pattern::Daily;
assert!(Daily::try_new(1).is_ok());
assert!(Daily::try_new(0).is_err());
assert!(Daily::try_new(-1).is_err());Sourcepub fn at<T: Into<Time>>(self, time: T) -> Daily
pub fn at<T: Into<Time>>(self, time: T) -> Daily
Sets the exact time of day for the daily recurrence.
§Example
use jiff::civil::time;
use recurring::pattern::daily;
let every_day_at_twelve = daily(1).at(time(12, 0, 0, 0));
let every_day_at_midnight_and_twelve = every_day_at_twelve.at(time(0, 0, 0, 0));Trait Implementations§
Source§impl Pattern for Daily
impl Pattern for Daily
Source§fn next_after(
&self,
instant: DateTime,
range: DateTimeRange,
) -> Option<DateTime>
fn next_after( &self, instant: DateTime, range: DateTimeRange, ) -> Option<DateTime>
Source§fn previous_before(
&self,
instant: DateTime,
range: DateTimeRange,
) -> Option<DateTime>
fn previous_before( &self, instant: DateTime, range: DateTimeRange, ) -> Option<DateTime>
Source§fn closest_to(
&self,
instant: DateTime,
range: DateTimeRange,
) -> Option<DateTime>
fn closest_to( &self, instant: DateTime, range: DateTimeRange, ) -> Option<DateTime>
impl Eq for Daily
impl StructuralPartialEq for Daily
Auto Trait Implementations§
impl Freeze for Daily
impl RefUnwindSafe for Daily
impl Send for Daily
impl Sync for Daily
impl Unpin for Daily
impl UnwindSafe for Daily
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