pub struct ResetSignalAllocation(/* private fields */);Expand description
Structure meant to be stored in a static to signal applications that they have been factory-resetted by the admin app
It is expected to have one such structure for each application supporting factory-reset by the admin-app
ⓘ
#[derive(Default, PartialEq, serde::Deserialize, serde::Serialize)]
struct Config {
use_new_backend: bool,
};
static OPCARD_RESET: ResetSignalAllocation = ResetSignalAllocation::new();
impl admin_app::Config for Config {
fn field(&mut self, key: &str) -> Option<ConfigValueMut<'_>> {
match key {
"opcard.use_new_backend" => Some(ConfigValueMut::Bool(&mut self.use_new_backend)),
_ => None,
}
}
/// Client ID to factory-reset if the associated configuration option is changed
fn reset_client_id(&self, key: &str) -> Option<(&'static Path, &'static ResetSignalAllocation)> {
match key {
"opcard" => Some((path!("opcard"), &OPCARD_RESET)),
"opcard.use_new_backend" =>Some((path!("opcard"), &OPCARD_RESET)),
_ => None,
}
}
}Implementations§
Source§impl ResetSignalAllocation
impl ResetSignalAllocation
pub const fn new() -> Self
pub fn load(&self) -> ResetSignal
pub fn set_factory_reset(&self) -> bool
pub fn set_config_changed(&self)
Sourcepub fn ack_factory_reset(&self) -> bool
pub fn ack_factory_reset(&self) -> bool
Factory reset can be acknowledged so that the application can restart working
A configuration change cannot be acknowledged as it requires a power cycle to be taken into account.
Trait Implementations§
Source§impl Debug for ResetSignalAllocation
impl Debug for ResetSignalAllocation
Auto Trait Implementations§
impl !Freeze for ResetSignalAllocation
impl RefUnwindSafe for ResetSignalAllocation
impl Send for ResetSignalAllocation
impl Sync for ResetSignalAllocation
impl Unpin for ResetSignalAllocation
impl UnsafeUnpin for ResetSignalAllocation
impl UnwindSafe for ResetSignalAllocation
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