pub struct Rtc(Arc<Mutex<File>>);Expand description
Interface to the hardware real-time clock device.
Rtc provides access to both time and alarm functionality of the RTC.
Operations are serialized via an internal mutex to ensure thread-safe access
to the underlying device file.
Tuple Fields§
§0: Arc<Mutex<File>>Implementations§
Source§impl Rtc
impl Rtc
Sourcepub fn set_alarm(&self, wake_time: DateTime<Utc>) -> Result<i32, Error>
pub fn set_alarm(&self, wake_time: DateTime<Utc>) -> Result<i32, Error>
Programs the hardware to wake at the specified time.
Enables a single-shot alarm that will fire at the given UTC time. If an alarm is already scheduled, it is replaced.
§Arguments
wake_time- The UTC time when the alarm should fire
§Returns
A status code on success (typically 0 if supported), or an error if the ioctl fails or the lock is poisoned.
Sourcepub fn disable_alarm(&self) -> Result<i32, Error>
pub fn disable_alarm(&self) -> Result<i32, Error>
Disables the hardware alarm.
Clears any pending alarm without affecting the alarm time itself.
§Returns
A status code on success (typically 0 if supported), or an error if the ioctl fails or the lock is poisoned.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Rtc
impl RefUnwindSafe for Rtc
impl Send for Rtc
impl Sync for Rtc
impl Unpin for Rtc
impl UnsafeUnpin for Rtc
impl UnwindSafe for Rtc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more