pub struct State { /* private fields */ }
Expand description
The persistent Timekeeper state.
See the method documentation for the specific components of the state that is being persisted.
Implementations§
Source§impl State
impl State
pub fn new(update_rtc: bool) -> Self
Sourcepub fn may_update_rtc(&self) -> bool
pub fn may_update_rtc(&self) -> bool
Returns whether updating the RTC clock is allowed.
pub fn set_may_update_rtc(&mut self, update_rtc: bool)
Sourcepub fn get_rtc_reference(&self) -> (BootInstant, Instant<UtcTimeline>)
pub fn get_rtc_reference(&self) -> (BootInstant, Instant<UtcTimeline>)
Gets a known-good reference point on the boot-to-utc affine transform.
Sourcepub fn set_rtc_reference(
&mut self,
boot_reference: BootInstant,
utc_reference: Instant<UtcTimeline>,
)
pub fn set_rtc_reference( &mut self, boot_reference: BootInstant, utc_reference: Instant<UtcTimeline>, )
Sets a known-good reference point on the boot-to-utc affine transform.
This setting can be used to recover a known-good UTC estimate.
§Args
boot_reference
: a reference instant on the boot timeline.utc_reference
: a reference instant on the UTC timeline that corresponds toboot_timeline
.
Sourcepub fn read_and_update() -> Result<Self>
pub fn read_and_update() -> Result<Self>
Reads the persistent state, updating the testing-only components.
pub fn read_and_update_internal<P: AsRef<Path>>(path: P) -> Result<Self>
Sourcepub fn write(state: &Self) -> Result<()>
pub fn write(state: &Self) -> Result<()>
Write the persistent state to mutable persistent storage.
pub fn write_internal<P: AsRef<Path>>(path: P, state: &Self) -> Result<()>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for State
impl<'de> Deserialize<'de> for State
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for State
impl RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl UnwindSafe for State
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