Enum kairos::timetype::TimeType [] [src]

pub enum TimeType {
    Seconds(i64),
    Minutes(i64),
    Hours(i64),
    Days(i64),
    Months(i64),
    Years(i64),
    Moment(NaiveDateTime),
    Addition(Box<TimeType>, Box<TimeType>),
    Subtraction(Box<TimeType>, Box<TimeType>),
    EndOfYear(Box<TimeType>),
    EndOfMonth(Box<TimeType>),
    EndOfDay(Box<TimeType>),
    EndOfHour(Box<TimeType>),
    EndOfMinute(Box<TimeType>),
}

A Type of Time, currently based on chrono::NaiveDateTime

Variants

Methods

impl TimeType
[src]

The TimeType type

Warning

If the TimeType is larger than the queried type (E.G. querying a "minutes" on a "month"), the following rules are applied:

  • 60 Seconds make a Minute
  • 60 Minutes make a Hour
  • 24 Hours make a Day
  • 7 Days make a Week
  • 4 Weeks make a Month
  • 12 Months make a Year

Whether these may be correct or not in the current year. The return value of the function is calculated appropriately. So, calling the get_seconds() function on 5 minutes returns 60 * 5.

If the TimeType is smaller than the queried type (E.G. querying a "month" on a "minutes"), zero is returned.

Also, if the TimeType is "5 weeks", querying a month returns 1, as 5 weeks contain one full month.

[src]

Alias for TimeType::moment(::chrono::offset::Local::now().naive_local())

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

Helper for TimeType::days(i * 7)

[src]

[src]

[src]

[src]

Calculate the end of the year based on the current TimeType

The end of a year is considered to be the last day of the year, not the last second.

Warning

If the current TimeType does not evaluate to a TimeType::Moment, calculating the end of the year will fail

[src]

Calculate the end of the month based on the current TimeType

The end of a month is considered to be the last day of the month, not the last second.

Warning

If the current TimeType does not evaluate to a TimeType::Moment, calculating the end of the month will fail

[src]

Calculate the end of the day based on the current TimeType

The end of a day is considered the last second of the day

Warning

If the current TimeType does not evaluate to a TimeType::Moment, calculating the end of the day will fail

[src]

Calculate the end of the hour based on the current TimeType

The end of a hour is considered the last second of a hour

Warning

If the current TimeType does not evaluate to a TimeType::Moment, calculating the end of the hour will fail

[src]

Calculate the end of the minute based on the current TimeType

The end of a minute is considered to be the last second of a minute

Warning

If the current TimeType does not evaluate to a TimeType::Moment, calculating the end of the minute will fail

[src]

Get the number of seconds, if the TimeType is not a duration type, zero is returned

Warning

If the type is actually a smaller one (eg. calling get_minutes() on a seconds instance) the following rules are applied:

  • A minute is 60 seconds
  • A hour is 60 minutes
  • A day is 24 hours
  • A month is 30 days
  • A year is 12 months

Which might not be always correct.

[src]

Get the number of minutes, if the TimeType is not a duration type, zero is returned

Warning

If the type is actually a smaller one (eg. calling get_minutes() on a seconds instance) the following rules are applied:

  • A minute is 60 seconds
  • A hour is 60 minutes
  • A day is 24 hours
  • A month is 30 days
  • A year is 12 months

Which might not be always correct.

[src]

Get the number of hours, if the TimeType is not a duration type, zero is returned

Warning

If the type is actually a smaller one (eg. calling get_minutes() on a seconds instance) the following rules are applied:

  • A minute is 60 seconds
  • A hour is 60 minutes
  • A day is 24 hours
  • A month is 30 days
  • A year is 12 months

Which might not be always correct.

[src]

Get the number of days, if the TimeType is not a duration type, zero is returned

Warning

If the type is actually a smaller one (eg. calling get_minutes() on a seconds instance) the following rules are applied:

  • A minute is 60 seconds
  • A hour is 60 minutes
  • A day is 24 hours
  • A month is 30 days
  • A year is 12 months

Which might not be always correct.

[src]

Get the number of months, if the TimeType is not a duration type, zero is returned

Warning

If the type is actually a smaller one (eg. calling get_minutes() on a seconds instance) the following rules are applied:

  • A minute is 60 seconds
  • A hour is 60 minutes
  • A day is 24 hours
  • A month is 30 days
  • A year is 12 months

Which might not be always correct.

[src]

Get the number of years, if the TimeType is not a duration type, zero is returned

Warning

If the type is actually a smaller one (eg. calling get_minutes() on a seconds instance) the following rules are applied:

  • A minute is 60 seconds
  • A hour is 60 minutes
  • A day is 24 hours
  • A month is 30 days
  • A year is 12 months

Which might not be always correct.

[src]

[src]

Check whether a TimeType::Moment is a certain weekday. Returns an error if TimeType is not a TimeType::Moment.

[src]

Check whether a TimeType::Moment is in a certain month. Returns an error if the TimeType is not a TimeType::Moment.

[src]

Get a string representation of the variant of the TimeType instance.

[src]

Trait Implementations

impl Minutely for TT
[src]

[src]

impl Hourly for TT
[src]

[src]

impl Daily for TT
[src]

[src]

impl Weekly for TT
[src]

[src]

Conveniance function over Daily::daily( n * 7 )

impl Monthly for TT
[src]

[src]

impl Yearly for TT
[src]

[src]

impl Every for TT
[src]

[src]

impl Debug for TimeType
[src]

[src]

Formats the value using the given formatter.

impl Clone for TimeType
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq for TimeType
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Eq for TimeType
[src]

impl PartialOrd for TimeType
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

This method tests less than (for self and other) and is used by the < operator. Read more

[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for TimeType
[src]

[src]

This method returns an Ordering between self and other. Read more

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more

impl Add for TimeType
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl AddAssign for TimeType
[src]

[src]

Performs the += operation.

impl Sub for TimeType
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl SubAssign for TimeType
[src]

[src]

Performs the -= operation.

impl IntoTimeType for TimeType
[src]