Struct diem_management::config::Config
source · pub struct Config {
pub chain_id: ChainId,
pub json_server: String,
pub shared_backend: SecureBackend,
pub validator_backend: SecureBackend,
}
Expand description
A config file for working with management tooling.
Example:
use diem_management::config::ConfigPath;
use structopt::StructOpt;
#[derive(Clone, Debug, StructOpt)]
struct TestCommandLine {
#[structopt(long, required_unless("config"))]
test: Option<String>,
#[structopt(flatten)]
config: ConfigPath,
}
let config = "cmd --config test";
TestCommandLine::from_iter(config.split_whitespace());
let data = "cmd --test test";
TestCommandLine::from_iter(data.split_whitespace());
// Unfortunately there's no easy way to catch these, so these are here purley for demo:
// let help = "cmd --help";
// let result = TestCommandLine::from_iter(help.split_whitespace());
// Output:
// ...
// OPTIONS:
// --config <config> Path to a diem-management configuration file
// --test <test>
// let none = "cmd";
// let result = TestCommandLine::from_iter(none.split_whitespace());
// Output:
// error: The following required arguments were not provided:
// --test <test>
//
// USAGE:
// cmd [OPTIONS] --test <test>
Config for diem management tools
Fields§
§chain_id: ChainId
§json_server: String
§validator_backend: SecureBackend
Implementations§
source§impl Config
impl Config
pub fn load(path: &Path) -> Result<Config, Error>
pub fn override_chain_id(self, chain_id: Option<ChainId>) -> Self
pub fn override_json_server(self, json_server: &Option<String>) -> Self
pub fn override_validator_backend( self, validator_backend: &Option<SecureBackend> ) -> Result<Self, Error>
pub fn validator_backend(&self) -> StorageWrapper
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
source§impl PartialEq<Config> for Config
impl PartialEq<Config> for Config
impl Eq for Config
impl StructuralEq 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§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> PersistableConfig for Twhere
T: Serialize + DeserializeOwned + ?Sized,
impl<T> PersistableConfig for Twhere T: Serialize + DeserializeOwned + ?Sized,
source§impl<T> Serialize for Twhere
T: Serialize + ?Sized,
impl<T> Serialize for Twhere T: Serialize + ?Sized,
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
§impl<T> TestOnlyHash for Twhere
T: Serialize + ?Sized,
impl<T> TestOnlyHash for Twhere T: Serialize + ?Sized,
§fn test_only_hash(&self) -> HashValue
fn test_only_hash(&self) -> HashValue
Generates a hash used only for tests.