Struct aether_lib::config::Config
source · [−]pub struct Config {
pub aether: AetherConfig,
pub handshake: HandshakeConfig,
pub link: LinkConfig,
}
Expand description
Structure to represent configuration options for aether_lib
Fields
aether: AetherConfig
Configuration for peer
module
handshake: HandshakeConfig
Configuration for handshake
module
link: LinkConfig
Configuration for link
module
Implementations
sourceimpl Config
impl Config
sourcepub fn from_file(file_path: &Path) -> Result<Config, AetherError>
pub fn from_file(file_path: &Path) -> Result<Config, AetherError>
Returns configuration read from file_path
Configuration file must be in YAML format
This may return an AetherError
if the file is not present or if the file
is not correctly formated as yaml
Examples
use aether_lib::config::Config;
use std::path::Path;
// For a file located inside /home/user/aether_config.yaml we can construct
// a path
let path = Path::new("/home/user/aether_config.yaml");
let config = Config::from_file(&path);
sourcepub fn get_config() -> Result<Config, AetherError>
pub fn get_config() -> Result<Config, AetherError>
Returns configuration read from the default configuration file If default configuration file is not found, the default internal configuration is returned
Examples
use aether_lib::config::Config;
let config = Config::get_config();
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Config where
Config: Default,
impl<'de> Deserialize<'de> for Config where
Config: Default,
sourcefn 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
impl Copy for Config
impl StructuralPartialEq for Config
Auto Trait Implementations
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more