Skip to main content

Config

Trait Config 

Source
pub trait Config:
    Default
    + PartialEq
    + DeserializeOwned
    + Serialize {
    // Required methods
    fn field(&mut self, key: &str) -> Option<ConfigValueMut<'_>>;
    fn migration_version(&self) -> Option<u32>;
    fn set_migration_version(&mut self, _version: u32) -> bool;
    fn list_available_fields(&self) -> &'static [ConfigField];

    // Provided methods
    fn reset_client_id(
        &self,
        _key: &str,
    ) -> Option<(&'static Path, &'static ResetSignalAllocation)> { ... }
    fn reset_client_config(&mut self, _key: &str) -> ResetConfigResult { ... }
}

Required Methods§

Source

fn field(&mut self, key: &str) -> Option<ConfigValueMut<'_>>

Source

fn migration_version(&self) -> Option<u32>

The migration version

Return None if the configuration does not support storing the migration version

Source

fn set_migration_version(&mut self, _version: u32) -> bool

Set the migration version

Return false if the configuration does not support storing the migration version

Source

fn list_available_fields(&self) -> &'static [ConfigField]

Provided Methods§

Source

fn reset_client_id( &self, _key: &str, ) -> Option<(&'static Path, &'static ResetSignalAllocation)>

Client ID to factory-reset if the associated configuration option is changed

§If the Request is for a client_id:
  • MUST return Some to indicate that the client can be factory reset by the admin app, In that case, the path is the clientid that must be reset, and the allocation must point to a signal that id checked by the application.
  • MUST return None otherwise.
Source

fn reset_client_config(&mut self, _key: &str) -> ResetConfigResult

Reset the config of a client to its default value

Returns true if the config has been changed as a result

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Config for ()

Source§

fn field(&mut self, _key: &str) -> Option<ConfigValueMut<'_>>

Source§

fn reset_client_config(&mut self, _key: &str) -> ResetConfigResult

Source§

fn migration_version(&self) -> Option<u32>

Source§

fn set_migration_version(&mut self, _version: u32) -> bool

Source§

fn list_available_fields(&self) -> &'static [ConfigField]

Implementors§