sel4_driver_interfaces/
rtc.rsuse core::cell::RefCell;
use core::ops::Deref;
use lock_api::{Mutex, RawMutex};
use crate::{WrappedMutex, WrappedRefCell, WrappedRefCellError};
pub use rtcc::{DateTime, DateTimeAccess, Datelike, NaiveDate, NaiveDateTime, NaiveTime, Timelike};
impl<T: Deref<Target = RefCell<U>>, U: DateTimeAccess> DateTimeAccess for &WrappedRefCell<T> {
type Error = WrappedRefCellError<U::Error>;
fn datetime(&mut self) -> Result<NaiveDateTime, Self::Error> {
self.with_mut(|this| this.datetime())
}
fn set_datetime(&mut self, datetime: &NaiveDateTime) -> Result<(), Self::Error> {
self.with_mut(|this| this.set_datetime(datetime))
}
}
impl<R: RawMutex, T: Deref<Target = Mutex<R, U>>, U: DateTimeAccess> DateTimeAccess
for &WrappedMutex<T>
{
type Error = U::Error;
fn datetime(&mut self) -> Result<NaiveDateTime, Self::Error> {
self.with_mut(|this| this.datetime())
}
fn set_datetime(&mut self, datetime: &NaiveDateTime) -> Result<(), Self::Error> {
self.with_mut(|this| this.set_datetime(datetime))
}
}