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§unsafe fn clone_to_uninit(&self, dst: *mut T)
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
.