pub struct ConfigManager<F: FileSystem> { /* private fields */ }Implementations§
Source§impl<F: FileSystem> ConfigManager<F>
impl<F: FileSystem> ConfigManager<F>
pub const fn with_fs(fs: F, config_dir: PathBuf) -> Self
Sourcepub fn add_spec(
&self,
name: &str,
file_path: &Path,
force: bool,
) -> Result<(), Error>
pub fn add_spec( &self, name: &str, file_path: &Path, force: bool, ) -> Result<(), Error>
Adds a new OpenAPI specification to the configuration.
§Errors
Returns an error if:
- The spec already exists and
forceis false - File I/O operations fail
- The
OpenAPIspec is invalid YAML - The spec contains unsupported features
§Panics
Panics if the spec path parent directory is None (should not happen in normal usage).
Sourcepub fn remove_spec(&self, name: &str) -> Result<(), Error>
pub fn remove_spec(&self, name: &str) -> Result<(), Error>
Removes an API specification from the configuration.
§Errors
Returns an error if the spec does not exist or cannot be removed.
Sourcepub fn edit_spec(&self, name: &str) -> Result<(), Error>
pub fn edit_spec(&self, name: &str) -> Result<(), Error>
Opens an API specification in the default editor.
§Errors
Returns an error if:
- The spec does not exist.
- The
$EDITORenvironment variable is not set. - The editor command fails to execute.
Sourcepub fn load_global_config(&self) -> Result<GlobalConfig, Error>
pub fn load_global_config(&self) -> Result<GlobalConfig, Error>
Loads the global configuration from config.toml.
§Errors
Returns an error if the configuration file exists but cannot be read or parsed.
Sourcepub fn save_global_config(&self, config: &GlobalConfig) -> Result<(), Error>
pub fn save_global_config(&self, config: &GlobalConfig) -> Result<(), Error>
Saves the global configuration to config.toml.
§Errors
Returns an error if the configuration cannot be serialized or written.
Sourcepub fn set_url(
&self,
api_name: &str,
url: &str,
environment: Option<&str>,
) -> Result<(), Error>
pub fn set_url( &self, api_name: &str, url: &str, environment: Option<&str>, ) -> Result<(), Error>
Auto Trait Implementations§
impl<F> Freeze for ConfigManager<F>where
F: Freeze,
impl<F> RefUnwindSafe for ConfigManager<F>where
F: RefUnwindSafe,
impl<F> Send for ConfigManager<F>where
F: Send,
impl<F> Sync for ConfigManager<F>where
F: Sync,
impl<F> Unpin for ConfigManager<F>where
F: Unpin,
impl<F> UnwindSafe for ConfigManager<F>where
F: UnwindSafe,
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