chore: please the formatter
parent
2e6ac5cda6
commit
4fb6f629ac
|
@ -36,6 +36,7 @@ enum ParseError as u8 {
|
||||||
too_many_parts = 4
|
too_many_parts = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// str returns the string representation of a ParseError.
|
||||||
fn (e ParseError) str() string {
|
fn (e ParseError) str() string {
|
||||||
return match e {
|
return match e {
|
||||||
.ok { '' }
|
.ok { '' }
|
||||||
|
|
|
@ -2,11 +2,13 @@ module cron
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
// free the memory associated with the Expression.
|
||||||
[unsafe]
|
[unsafe]
|
||||||
pub fn (ce &Expression) free() {
|
pub fn (ce &Expression) free() {
|
||||||
C.ce_free(ce)
|
C.ce_free(ce)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// parse_expression parses a string into an Expression.
|
||||||
pub fn parse_expression(exp string) !&Expression {
|
pub fn parse_expression(exp string) !&Expression {
|
||||||
out := C.ce_init()
|
out := C.ce_init()
|
||||||
res := C.ce_parse_expression(out, exp.str)
|
res := C.ce_parse_expression(out, exp.str)
|
||||||
|
@ -18,6 +20,8 @@ pub fn parse_expression(exp string) !&Expression {
|
||||||
return out
|
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 {
|
pub fn (ce &Expression) next(ref time.Time) time.Time {
|
||||||
st := SimpleTime{
|
st := SimpleTime{
|
||||||
year: ref.year
|
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 {
|
pub fn (ce &Expression) next_from_now() time.Time {
|
||||||
out := SimpleTime{}
|
out := SimpleTime{}
|
||||||
C.ce_next_from_now(&out, ce)
|
C.ce_next_from_now(&out, ce)
|
||||||
|
|
Loading…
Reference in New Issue