Skip to main content

ResetSignalAllocation

Struct ResetSignalAllocation 

Source
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

Source

pub const fn new() -> Self

Source

pub fn load(&self) -> ResetSignal

Source

pub fn set_factory_reset(&self) -> bool

Source

pub fn set_config_changed(&self)

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ResetSignalAllocation

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V