Struct mz::config_file::ConfigFile
source · pub struct ConfigFile {
path: PathBuf,
parsed: TomlConfigFile,
editable: Document,
}
Expand description
Represents an on-disk configuration file for mz
.
Fields§
§path: PathBuf
§parsed: TomlConfigFile
§editable: Document
Implementations§
source§impl ConfigFile
impl ConfigFile
sourcepub fn default_path() -> Result<PathBuf, Error>
pub fn default_path() -> Result<PathBuf, Error>
Computes the default path for the configuration file.
sourcepub async fn load(path: PathBuf) -> Result<ConfigFile, Error>
pub async fn load(path: PathBuf) -> Result<ConfigFile, Error>
Loads a configuration file from the specified path.
sourcepub fn load_profile<'a>(&'a self, name: &'a str) -> Result<Profile<'_>, Error>
pub fn load_profile<'a>(&'a self, name: &'a str) -> Result<Profile<'_>, Error>
Loads a profile from the configuration file. Panics if the profile is not found.
sourcepub async fn add_profile(
&self,
name: String,
profile: TomlProfile,
) -> Result<(), Error>
pub async fn add_profile( &self, name: String, profile: TomlProfile, ) -> Result<(), Error>
Adds a new profile to the config file.
sourcepub fn add_app_password(
&self,
new_profile: &mut Table,
_name: &str,
profile: TomlProfile,
) -> Result<(), Error>
pub fn add_app_password( &self, new_profile: &mut Table, _name: &str, profile: TomlProfile, ) -> Result<(), Error>
Adds an app-password to the configuration file.
sourcepub async fn remove_profile<'a>(&self, name: &str) -> Result<(), Error>
pub async fn remove_profile<'a>(&self, name: &str) -> Result<(), Error>
Removes a profile from the configuration file.
sourcepub fn profiles(&self) -> Option<BTreeMap<String, TomlProfile>>
pub fn profiles(&self) -> Option<BTreeMap<String, TomlProfile>>
Retrieves all the available profiles
sourcepub fn list_profile_params(
&self,
profile_name: &str,
) -> Result<Vec<(&str, Option<String>)>, Error>
pub fn list_profile_params( &self, profile_name: &str, ) -> Result<Vec<(&str, Option<String>)>, Error>
Returns a list of all the possible profile configuration values
sourcepub fn get_profile_param<'a>(
&'a self,
name: &str,
profile: &'a str,
) -> Result<Option<&str>, Error>
pub fn get_profile_param<'a>( &'a self, name: &str, profile: &'a str, ) -> Result<Option<&str>, Error>
Gets the value of a profile’s configuration parameter.
sourcepub async fn set_profile_param(
&self,
profile_name: &str,
name: &str,
value: Option<&str>,
) -> Result<(), Error>
pub async fn set_profile_param( &self, profile_name: &str, name: &str, value: Option<&str>, ) -> Result<(), Error>
Sets the value of a profile’s configuration parameter.
Trait Implementations§
source§impl Clone for ConfigFile
impl Clone for ConfigFile
source§fn clone(&self) -> ConfigFile
fn clone(&self) -> ConfigFile
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ConfigFile
impl RefUnwindSafe for ConfigFile
impl Send for ConfigFile
impl Sync for ConfigFile
impl Unpin for ConfigFile
impl UnwindSafe for ConfigFile
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
source§impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
See
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
See
RustType::into_proto
.source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
The method of
std::ops::AddAssign
, for types that do not implement AddAssign
.