[−][src]Crate cron_clock
A cron expression parser and schedule explorer
Example
extern crate chrono; extern crate cron; use cron::Schedule; use chrono::Utc; use std::str::FromStr; fn main() { // sec min hour day of month month day of week year let expression = "0 30 9,12,15 1,15 May-Aug Mon,Wed,Fri 2018/2"; let schedule = Schedule::from_str(expression).unwrap(); println!("Upcoming fire times:"); for datetime in schedule.upcoming(Utc).take(10) { println!("-> {}", datetime); } } /* Upcoming fire times: -> 2018-06-01 09:30:00 UTC -> 2018-06-01 12:30:00 UTC -> 2018-06-01 15:30:00 UTC -> 2018-06-15 09:30:00 UTC -> 2018-06-15 12:30:00 UTC -> 2018-06-15 15:30:00 UTC -> 2018-08-01 09:30:00 UTC -> 2018-08-01 12:30:00 UTC -> 2018-08-01 15:30:00 UTC -> 2018-08-15 09:30:00 UTC */
Re-exports
pub use time_unit::TimeUnitSpec; |
Modules
bits | Bit level parsers and combinators |
error | |
example_generated | These modules show an example of code generated by the macro. IT MUST NOT BE USED OUTSIDE THIS CRATE. |
format | Formatting (and parsing) utilities for date and time. |
lib | Lib module to re-export everything needed from |
methods | Method macro combinators |
naive | Date and time types unconcerned with timezones. |
offset | The time zone, which calculates offsets from the local time to UTC. |
prelude | A convenience module appropriate for glob imports ( |
schedule | |
simple_errors | Error management |
time_unit | |
types | Custom input types |
whitespace | Support for whitespace delimited formats |
Macros
add_return_error | Add an error if the child parser fails |
alt | Try a list of parsers and return the result of the first successful one |
alt_complete | Is equivalent to the |
apply | emulate function currying: |
apply_m | emulate function currying for method calls on structs
|
bail | Exits a function early with an error |
bits | Transforms its byte slice input into a bit stream for the underlying parser. This allows the given bit stream parser to work on a byte slice input. |
bytes | Counterpart to bits, bytes! transforms its bit stream input into a byte slice for the underlying parser, allowing byte-slice parsers to work on bit streams. |
call | Used to wrap common expressions and function as macros |
call_m | Used to called methods then move self back into self |
char | matches one character: `char!(char) => &u8 -> IResult<&u8, char> |
closure | Wraps a parser in a closure |
complete | replaces a |
cond |
|
cond_reduce |
|
cond_with_error |
|
count |
|
count_fixed |
|
dbg | Prints a message if the parser fails |
dbg_dmp | Prints a message and the input if the parser fails |
delimited |
|
do_parse |
|
eat_separator | helper macros to build a separator parser |
ensure | Exits a function early with an error if the condition is not satisfied |
eof |
|
error_chain | This macro is used for handling of duplicated and out-of-order fields. For
the exact rules, see |
error_chain_processed | Prefer to use |
error_node_position | creates a parse error from a |
error_position | creates a parse error from a |
escaped |
|
escaped_transform |
|
exact |
|
expr_opt |
|
expr_res |
|
fix_error | translate parser result from IResult<I,O,u32> to IResult<I,O,E> with a custom type |
flat_map |
|
fold_many0 |
|
fold_many1 |
|
fold_many_m_n |
|
i16 | if the parameter is nom::Endianness::Big, parse a big endian i16 integer, otherwise a little endian i16 integer |
i32 | if the parameter is nom::Endianness::Big, parse a big endian i32 integer, otherwise a little endian i32 integer |
i64 | if the parameter is nom::Endianness::Big, parse a big endian i64 integer, otherwise a little endian i64 integer |
i128 | if the parameter is nom::Endianness::Big, parse a big endian i64 integer, otherwise a little endian i64 integer |
is_a |
|
is_a_s | Deprecated
|
is_not |
|
is_not_s | Deprecated
|
length_bytes |
|
length_count |
|
length_data |
|
length_value |
|
many0 |
|
many1 |
|
many_m_n |
|
many_till |
|
map |
|
map_opt |
|
map_res |
|
map_res_err |
|
method | Makes a method from a parser combination |
named | Makes a function from a parser combination |
named_args | Makes a function from a parser combination with arguments. |
named_attr | Makes a function from a parser combination, with attributes |
none_of | matches anything but the provided characters |
not |
|
one_of | matches one of the provided characters |
opt |
|
opt_res |
|
pair |
|
parse_to |
|
peek |
|
permutation |
|
preceded |
|
quick_error | |
quick_main | Convenient wrapper to be able to use |
recognize |
|
return_error | Prevents backtracking if the child parser fails |
sep | sep is the parser rewriting macro for whitespace separated formats |
separated_list |
|
separated_list_complete |
|
separated_nonempty_list |
|
separated_nonempty_list_complete |
|
separated_pair |
|
switch |
|
tag |
|
tag_bits | Matches the given bit pattern. |
tag_no_case |
|
tag_no_case_s | Deprecated
|
tag_s | Deprecated
|
take |
|
take_bits | Consumes the specified number of bits and returns them as the specified type. |
take_s | Deprecated
|
take_str |
|
take_till |
|
take_till1 |
|
take_till1_s | Deprecated
|
take_till_s | Deprecated
|
take_until |
|
take_until1 |
|
take_until_and_consume |
|
take_until_and_consume1 |
|
take_until_and_consume_s | Deprecated
|
take_until_either |
|
take_until_either1 |
|
take_until_either_and_consume |
|
take_until_either_and_consume1 |
|
take_until_s | Deprecated
|
take_while |
|
take_while1 |
|
take_while1_s | Deprecated
|
take_while_m_n |
|
take_while_s | Deprecated
|
tap |
|
terminated |
|
try_parse | A bit like |
tuple |
|
u16 | if the parameter is nom::Endianness::Big, parse a big endian u16 integer, otherwise a little endian u16 integer |
u32 | if the parameter is nom::Endianness::Big, parse a big endian u32 integer, otherwise a little endian u32 integer |
u64 | if the parameter is nom::Endianness::Big, parse a big endian u64 integer, otherwise a little endian u64 integer |
u128 | if the parameter is nom::Endianness::Big, parse a big endian u128 integer, otherwise a little endian u128 integer |
value |
|
verify |
|
wrap_sep | |
ws |
|
Structs
Backtrace | Representation of an owned and self-contained backtrace. |
Date | ISO 8601 calendar date with time zone. |
DateTime | ISO 8601 combined date and time with time zone. |
Display | A struct which formats an error for output. |
Duration | ISO 8601 time duration with nanosecond precision. This also allows for the negative duration; see individual methods for details. |
ErrorChainIter | Iterator over the error chain using the |
FixedOffset | The time zone with fixed offset, from UTC-23:59:59 to UTC+23:59:59. |
IsoWeek | ISO 8601 week. |
Local | The local timescale. This is implemented via the standard |
NaiveDate | ISO 8601 calendar date without timezone. Allows for every proleptic Gregorian date from Jan 1, 262145 BCE to Dec 31, 262143 CE. Also supports the conversion from ISO 8601 ordinal and week date. |
NaiveDateTime | ISO 8601 combined date and time without timezone. |
NaiveTime | ISO 8601 time without timezone. Allows for the nanosecond precision and optional leap second representation. |
ParseError | An error from the |
ParseWeekdayError | An error resulting from reading |
Utc | The UTC time zone. This is the most efficient time zone when you don't need the local time. It is also used as an offset (which is also a dummy type). |
Enums
CompareResult | indicates wether a comparison was successful, an error, or if more data was needed |
Context | |
Endianness | Configurable endianness |
Err | The |
ErrorKind | indicates which parser returned an error |
LocalResult | The conversion result from the local time to the timezone-aware datetime types. |
Needed | Contains information on needed data if a parser returned |
SecondsFormat | Specific formatting options for seconds. This may be extended in the future, so exhaustive matching in external code is not recommended. |
Weekday | The day of week. |
Constants
MAX_DATE | The maximum possible |
MIN_DATE | The minimum possible |
Traits
AsBytes | casts the input type to a byte slice |
AsChar | transforms common types to a char for basic token parsing |
AtEof | indicates whether more data can come later in input |
ChainedError | This trait is implemented on all the errors generated by the |
Compare | abstracts comparison operations |
Convert | |
Datelike | The common set of methods for date component. |
ExitCode | Represents a value that can be used as the exit status of the process.
See |
ExtendInto | abtracts something which can extend an |
FindSubstring | look for a substring in self |
FindToken | look for self in the given input stream |
HexDisplay | |
InputIter | abstracts common iteration operations on the input type |
InputLength | abstract method to calculate the input length |
InputTake | abstracts slicing operations |
InputTakeAtPosition | methods to take as much input as possible until the provided function returns true for the current element |
Offset | The offset from the local time to UTC. |
Offset | useful functions to calculate the offset between slices and show a hexdump of a slice |
ParseTo | used to integrate str's parse() method |
Slice | slicing operations using ranges |
SubsecRound | Extension trait for subsecond rounding or truncation to a maximum number of digits. Rounding can be used to decrease the error variance when serializing/persisting to lower precision. Truncation is the default behavior in Chrono display formatting. Either can be used to guarantee equality (e.g. for testing) when round-tripping through a lower precision format. |
TimeZone | The time zone. |
Timelike | The common set of methods for time component. |
UnspecializedInput | Dummy trait used for default implementations (currently only used for |
Functions
alpha | Recognizes one or more lowercase and uppercase alphabetic characters. For ASCII strings: a-zA-Z For UTF8 strings, any alphabetic code point (ie, not only the ASCII ones) |
alpha0 | Recognizes zero or more lowercase and uppercase alphabetic characters. For ASCII strings: a-zA-Z For UTF8 strings, any alphabetic code point (ie, not only the ASCII ones) |
alpha1 | Recognizes one or more lowercase and uppercase alphabetic characters For ASCII strings: a-zA-Z For UTF8 strings, any alphabetic code point (ie, not only the ASCII ones) |
alphanumeric | Recognizes one or more numerical and alphabetic characters For ASCII strings: 0-9a-zA-Z For UTF8 strings, 0-9 and any alphabetic code point (ie, not only the ASCII ones) |
alphanumeric0 | Recognizes zero or more numerical and alphabetic characters. For ASCII strings: 0-9a-zA-Z For UTF8 strings, 0-9 and any alphabetic code point (ie, not only the ASCII ones) |
alphanumeric1 | Recognizes one or more numerical and alphabetic characters. For ASCII strings: 0-9a-zA-Z For UTF8 strings, 0-9 and any alphabetic code point (ie, not only the ASCII ones) |
anychar | matches one byte as a character. Note that the input type will
accept a |
be_f32 | Recognizes big endian 4 bytes floating point number |
be_f64 | Recognizes big endian 8 bytes floating point number |
be_i8 | Recognizes a signed 1 byte integer (equivalent to take!(1) |
be_i16 | Recognizes big endian signed 2 bytes integer |
be_i24 | Recognizes big endian signed 3 bytes integer |
be_i32 | Recognizes big endian signed 4 bytes integer |
be_i64 | Recognizes big endian signed 8 bytes integer |
be_i128 | Recognizes big endian signed 16 bytes integer |
be_u8 | Recognizes an unsigned 1 byte integer (equivalent to take!(1) |
be_u16 | Recognizes big endian unsigned 2 bytes integer |
be_u24 | Recognizes big endian unsigned 3 byte integer |
be_u32 | Recognizes big endian unsigned 4 bytes integer |
be_u64 | Recognizes big endian unsigned 8 bytes integer |
be_u128 | Recognizes big endian unsigned 16 bytes integer |
begin | |
code_from_offset | |
crlf | |
digit | Recognizes one or more numerical characters: 0-9 |
digit0 | Recognizes zero or more numerical characters: 0-9 |
digit1 | Recognizes one or more numerical characters: 0-9 |
double | Recognizes floating point number in a byte string and returns a f64 |
double_s | Deprecated Recognizes floating point number in a string and returns a f64 |
eol | |
error_to_u32 | |
float | Recognizes floating point number in a byte string and returns a f32 |
float_s | Deprecated Recognizes floating point number in a string and returns a f32 |
hex_digit | Recognizes one or more hexadecimal numerical characters: 0-9, A-F, a-f |
hex_digit0 | Recognizes zero or more hexadecimal numerical characters: 0-9, A-F, a-f |
hex_digit1 | Recognizes one or more hexadecimal numerical characters: 0-9, A-F, a-f |
hex_u32 | Recognizes a hex-encoded integer |
is_alphabetic | Tests if byte is ASCII alphabetic: A-Z, a-z |
is_alphanumeric | Tests if byte is ASCII alphanumeric: A-Z, a-z, 0-9 |
is_digit | Tests if byte is ASCII digit: 0-9 |
is_hex_digit | Tests if byte is ASCII hex digit: 0-9, A-F, a-f |
is_oct_digit | Tests if byte is ASCII octal digit: 0-7 |
is_space | Tests if byte is ASCII space or tab |
le_f32 | Recognizes little endian 4 bytes floating point number |
le_f64 | Recognizes little endian 8 bytes floating point number |
le_i8 | Recognizes a signed 1 byte integer (equivalent to take!(1) |
le_i16 | Recognizes little endian signed 2 bytes integer |
le_i24 | Recognizes little endian signed 3 bytes integer |
le_i32 | Recognizes little endian signed 4 bytes integer |
le_i64 | Recognizes little endian signed 8 bytes integer |
le_i128 | Recognizes little endian signed 16 bytes integer |
le_u8 | Recognizes an unsigned 1 byte integer (equivalent to take!(1) |
le_u16 | Recognizes little endian unsigned 2 bytes integer |
le_u24 | Recognizes little endian unsigned 3 byte integer |
le_u32 | Recognizes little endian unsigned 4 bytes integer |
le_u64 | Recognizes little endian unsigned 8 bytes integer |
le_u128 | Recognizes little endian unsigned 16 bytes integer |
line_ending | Recognizes an end of line (both '\n' and '\r\n') |
multispace | Recognizes one or more spaces, tabs, carriage returns and line feeds |
multispace0 | Recognizes zero or more spaces, tabs, carriage returns and line feeds |
multispace1 | Recognizes one or more spaces, tabs, carriage returns and line feeds |
need_more | |
need_more_err | |
newline | Matches a newline character '\n' |
non_empty | Recognizes non empty buffers |
not_line_ending | |
oct_digit | Recognizes one or more octal characters: 0-7 |
oct_digit0 | Recognizes zero or more octal characters: 0-7 |
oct_digit1 | Recognizes one or more octal characters: 0-7 |
print_codes | |
recognize_float | |
reset_color | |
rest | Return the remaining input. |
rest_len | Return the length of the remaining input. |
rest_s | Return the remaining input, for strings. |
sized_buffer | |
slice_to_offsets | |
sp | |
space | Recognizes one or more spaces and tabs |
space0 | Recognizes zero or more spaces and tabs |
space1 | Recognizes one or more spaces and tabs |
tab | Matches a tab character '\t' |
tag_cl | |
write_color |
Type Definitions
IResult | Holds the result of parsing functions |
ParseResult | Same as |