pub struct Registry {
pub active: String,
pub backends: Vec<Backend>,
}Expand description
The registry: which backend is active, and the full list dove knows about.
Fields§
§active: String§backends: Vec<Backend>Implementations§
Source§impl Registry
impl Registry
Sourcepub fn load() -> Result<Registry>
pub fn load() -> Result<Registry>
Load the registry, migrating an old bare-Config file in place.
- New format (has
active+backends): parsed and returned as-is. - Legacy format (bare self-hosted fields, no
active/backends): wrapped into a"default"backend, saved back in the new format, and returned. - No file yet: an empty registry (
activeempty, no backends) — the “not provisioned yet” state. This does not itself surface thedove provision-pointing error the oldConfig::load()gave on a missing file; that guidance now lives inRegistry::active_backend, which every real read path goes through.
Sourcepub fn save(&self) -> Result<()>
pub fn save(&self) -> Result<()>
Write the registry to ~/.config/dove/config.toml (or $DOVE_CONFIG).
Sourcepub fn active_backend(&self) -> Result<&Backend>
pub fn active_backend(&self) -> Result<&Backend>
The currently-active backend. This is where “not provisioned yet” is
surfaced — same guidance the old Config::load() gave on a missing file.
Sourcepub fn set_active(&mut self, name: &str) -> Result<()>
pub fn set_active(&mut self, name: &str) -> Result<()>
Switch the active backend. Errors if no backend by that name exists.
Sourcepub fn upsert(&mut self, b: Backend)
pub fn upsert(&mut self, b: Backend)
Replace the backend with this name, or add it if none exists yet.
Sourcepub fn active_self_hosted(&self) -> Result<SelfHostedConfig>
pub fn active_self_hosted(&self) -> Result<SelfHostedConfig>
The active backend’s config, deserialized as a SelfHostedConfig.
Convenience for the CLI’s self-hosted-only read paths.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Registry
impl<'de> Deserialize<'de> for Registry
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
Auto Trait Implementations§
impl Freeze for Registry
impl RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
impl UnwindSafe for Registry
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