pub struct Config {
pub services: BTreeMap<String, Vec<Service>>,
}Fields§
§services: BTreeMap<String, Vec<Service>>A map from the hash of FMD secret key to the services it is registered with
Implementations§
Source§impl Config
impl Config
Sourcepub fn load_or_new(path: impl AsRef<Path>) -> Result<Self>
pub fn load_or_new(path: impl AsRef<Path>) -> Result<Self>
Load a config if it exists, otherwise create a new one
Sourcepub fn save(&mut self, path: impl AsRef<Path>) -> Result<()>
pub fn save(&mut self, path: impl AsRef<Path>) -> Result<()>
Save the config at the specified path
Sourcepub fn add_service(&mut self, key: String, url: &str, enc_key: EncKey)
pub fn add_service(&mut self, key: String, url: &str, enc_key: EncKey)
Add a new service which a specified key will be registered to.
Sourcepub fn get_services(&self, key: &String) -> Vec<Service>
pub fn get_services(&self, key: &String) -> Vec<Service>
Get the services that the specified key is configured to be registered to
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
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 Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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