chore: please the formatter

Jef Roosens 2023-01-14 20:48:14 +01:00
parent 2f4acf59e3
commit a135068b31
3 changed files with 8 additions and 1 deletions

View File

@ -36,6 +36,7 @@ enum ParseError as u8 {
too_many_parts = 4
}
// str returns the string representation of a ParseError.
fn (e ParseError) str() string {
return match e {
.ok { '' }

View File

@ -2,11 +2,13 @@ module cron
import time
// free the memory associated with the Expression.
[unsafe]
pub fn (ce &Expression) free() {
C.ce_free(ce)
}
// parse_expression parses a string into an Expression.
pub fn parse_expression(exp string) !&Expression {
out := C.ce_init()
res := C.ce_parse_expression(out, exp.str)
@ -18,6 +20,8 @@ pub fn parse_expression(exp string) !&Expression {
return out
}
// next calculates the next occurence of the cron schedule, given a reference
// point.
pub fn (ce &Expression) next(ref time.Time) time.Time {
st := SimpleTime{
year: ref.year
@ -39,6 +43,8 @@ pub fn (ce &Expression) next(ref time.Time) time.Time {
})
}
// next_from_now calculates the next occurence of the cron schedule with the
// current time as reference.
pub fn (ce &Expression) next_from_now() time.Time {
out := SimpleTime{}
C.ce_next_from_now(&out, ce)