pub struct Config(/* private fields */);Expand description
Zenoh configuration.
Most options are optional as a way to keep defaults flexible. Some of the options have different default values depending on the rest of the configuration.
To construct a configuration, we advise that you use a configuration file (JSON, JSON5 and YAML are currently supported, please use the proper extension for your format as the deserializer will be picked according to it).
Implementations§
Source§impl Config
impl Config
Sourcepub const DEFAULT_CONFIG_PATH_ENV: &'static str = "ZENOH_CONFIG"
pub const DEFAULT_CONFIG_PATH_ENV: &'static str = "ZENOH_CONFIG"
Default environment variable containing the file path used in Config::from_env.
Sourcepub fn from_env() -> ZResult<Self>
pub fn from_env() -> ZResult<Self>
Load configuration from the file path specified in the Self::DEFAULT_CONFIG_PATH_ENV
environment variable.
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> ZResult<Self>
pub fn from_file<P: AsRef<Path>>(path: P) -> ZResult<Self>
Load configuration from the file at path.
Sourcepub fn from_json5(input: &str) -> ZResult<Config>
pub fn from_json5(input: &str) -> ZResult<Config>
Load configuration from the JSON5 string input.
pub fn remove<K: AsRef<str>>(&mut self, key: K) -> ZResult<()>
Sourcepub fn insert_json5(&mut self, key: &str, value: &str) -> ZResult<()>
pub fn insert_json5(&mut self, key: &str, value: &str) -> ZResult<()>
Inserts configuration value value at key.
Sourcepub fn get_json(&self, key: &str) -> ZResult<String>
pub fn get_json(&self, key: &str) -> ZResult<String>
Returns a JSON string containing the configuration at key.
pub fn from_deserializer<'d, D: Deserializer<'d>>(
d: D,
) -> Result<Self, Result<Self, D::Error>>where
Self: Deserialize<'d>,
unstable only.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>,
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<Source> AccessAs for Source
impl<Source> AccessAs for Source
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more