Trait rtcc::Rtcc

source ·
pub trait Rtcc: DateTimeAccess {
Show 18 methods // Required methods fn seconds(&mut self) -> Result<u8, Self::Error>; fn minutes(&mut self) -> Result<u8, Self::Error>; fn hours(&mut self) -> Result<Hours, Self::Error>; fn time(&mut self) -> Result<NaiveTime, Self::Error>; fn weekday(&mut self) -> Result<u8, Self::Error>; fn day(&mut self) -> Result<u8, Self::Error>; fn month(&mut self) -> Result<u8, Self::Error>; fn year(&mut self) -> Result<u16, Self::Error>; fn date(&mut self) -> Result<NaiveDate, Self::Error>; fn set_seconds(&mut self, seconds: u8) -> Result<(), Self::Error>; fn set_minutes(&mut self, minutes: u8) -> Result<(), Self::Error>; fn set_hours(&mut self, hours: Hours) -> Result<(), Self::Error>; fn set_time(&mut self, time: &NaiveTime) -> Result<(), Self::Error>; fn set_weekday(&mut self, weekday: u8) -> Result<(), Self::Error>; fn set_day(&mut self, day: u8) -> Result<(), Self::Error>; fn set_month(&mut self, month: u8) -> Result<(), Self::Error>; fn set_year(&mut self, year: u16) -> Result<(), Self::Error>; fn set_date(&mut self, date: &NaiveDate) -> Result<(), Self::Error>;
}
Expand description

Real-Time Clock / Calendar trait

If you want to combine calls to these methods, prefer to use only the DateTimeAccess trait to avoid situations where the passing of time makes the results of the method calls inconsistent.

For example, this can happen at certain timepoints:

  1. The time is 01:59:59
  2. A call to hours() returns 1.
  3. The time is increased to 02:00:00.
  4. A call to minutes() returns 0.
  5. A call to seconds() returns 0.
  6. Your system thinks it is 01:00:00.

The same applies to the date, as well as when calling setter methods.

Required Methods§

source

fn seconds(&mut self) -> Result<u8, Self::Error>

Read the seconds.

source

fn minutes(&mut self) -> Result<u8, Self::Error>

Read the minutes.

source

fn hours(&mut self) -> Result<Hours, Self::Error>

Read the hours.

source

fn time(&mut self) -> Result<NaiveTime, Self::Error>

Read the time.

source

fn weekday(&mut self) -> Result<u8, Self::Error>

Read the day of the week [1-7].

source

fn day(&mut self) -> Result<u8, Self::Error>

Read the day of the month [1-31].

source

fn month(&mut self) -> Result<u8, Self::Error>

Read the month [1-12].

source

fn year(&mut self) -> Result<u16, Self::Error>

Read the year (e.g. 2000).

source

fn date(&mut self) -> Result<NaiveDate, Self::Error>

Read the date.

source

fn set_seconds(&mut self, seconds: u8) -> Result<(), Self::Error>

Set the seconds [0-59].

source

fn set_minutes(&mut self, minutes: u8) -> Result<(), Self::Error>

Set the minutes [0-59].

source

fn set_hours(&mut self, hours: Hours) -> Result<(), Self::Error>

Set the hours.

Changes the operating mode to 12h/24h depending on the parameter.

source

fn set_time(&mut self, time: &NaiveTime) -> Result<(), Self::Error>

Set the time.

source

fn set_weekday(&mut self, weekday: u8) -> Result<(), Self::Error>

Set the day of week [1-7].

source

fn set_day(&mut self, day: u8) -> Result<(), Self::Error>

Set the day of month [1-31].

source

fn set_month(&mut self, month: u8) -> Result<(), Self::Error>

Set the month [1-12].

source

fn set_year(&mut self, year: u16) -> Result<(), Self::Error>

Set the year. (e.g. 2000)

source

fn set_date(&mut self, date: &NaiveDate) -> Result<(), Self::Error>

Set the date.

Implementors§