Struct cronchik::CronSchedule
source · [−]pub struct CronSchedule { /* private fields */ }
Expand description
Cron schedule.
Size
184 bytes.
This is relatively big struct, which might be better suited to be allocated on heap.
So if you expect to move it a lot, prefer heap.
Alternatively you could store cron expression as String
and parse it each time.
Usage
use cronchik::CronSchedule;
let schedule = CronSchedule::parse_str("5 * * * *").unwrap();
assert_eq!(core::mem::size_of::<CronSchedule>(), 184);
let display = format!("{}", schedule);
assert_eq!(display, "5 * * * *");
Implementations
sourceimpl CronSchedule
impl CronSchedule
sourcepub fn parse_str(text: &str) -> Result<Self, ParseError>
pub fn parse_str(text: &str) -> Result<Self, ParseError>
Parses cron expression from string.
sourcepub fn days_of_month(&self) -> &[DayOfMonth]
pub fn days_of_month(&self) -> &[DayOfMonth]
Returns ordered list of scheduled days in month to run at.
sourcepub fn days_of_week(&self) -> &[Day]
pub fn days_of_week(&self) -> &[Day]
Returns ordered list of scheduled days in week to run at.
sourcepub fn next_time_from(&self, time: OffsetDateTime) -> OffsetDateTime
pub fn next_time_from(&self, time: OffsetDateTime) -> OffsetDateTime
Returns next point if time, after time
, accordingly to the schedule.
Available with time
feature
sourcepub fn next_time_from_now(&self) -> OffsetDateTime
pub fn next_time_from_now(&self) -> OffsetDateTime
Returns next point if time, after current time in UTC timezone.
Available with time
feature
Trait Implementations
sourceimpl Clone for CronSchedule
impl Clone for CronSchedule
sourcefn clone(&self) -> CronSchedule
fn clone(&self) -> CronSchedule
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CronSchedule
impl Debug for CronSchedule
sourceimpl<'de> Deserialize<'de> for CronSchedule
impl<'de> Deserialize<'de> for CronSchedule
sourcefn deserialize<D: Deserializer<'de>>(des: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(des: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for CronSchedule
impl Display for CronSchedule
sourceimpl PartialEq<CronSchedule> for CronSchedule
impl PartialEq<CronSchedule> for CronSchedule
sourcefn eq(&self, other: &CronSchedule) -> bool
fn eq(&self, other: &CronSchedule) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &CronSchedule) -> bool
fn ne(&self, other: &CronSchedule) -> bool
This method tests for !=
.
sourceimpl Serialize for CronSchedule
impl Serialize for CronSchedule
impl Eq for CronSchedule
impl StructuralEq for CronSchedule
impl StructuralPartialEq for CronSchedule
Auto Trait Implementations
impl RefUnwindSafe for CronSchedule
impl Send for CronSchedule
impl Sync for CronSchedule
impl Unpin for CronSchedule
impl UnwindSafe for CronSchedule
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more