pub struct Config { /* private fields */ }Implementations§
Source§impl Config
impl Config
pub fn load(path: &Path) -> Result<Self>
pub fn from_toml(text: &str) -> Result<Self>
pub fn from_json(text: &str) -> Result<Self>
Sourcepub fn is_flat_json(text: &str) -> bool
pub fn is_flat_json(text: &str) -> bool
True when a JSON file still has settings at the top level: it predates the sections, and rewriting it is the upgrade.
pub fn get(&self, key: &str) -> Option<&Value>
Sourcepub fn string(&self, key: &str) -> Option<String>
pub fn string(&self, key: &str) -> Option<String>
A setting as a string: numbers and booleans render the way the shell
wrote them, so .env output is unchanged.
pub fn str_or<'a>(&'a self, key: &str, fallback: &'a str) -> String
Sourcepub fn bool_or(&self, key: &str, fallback: bool) -> bool
pub fn bool_or(&self, key: &str, fallback: bool) -> bool
The shell’s is_true: only these spellings are true.
pub fn port(&self, key: &str, fallback: u16) -> u16
pub fn set(&mut self, key: &str, value: Value)
pub fn remove(&mut self, key: &str)
pub fn keys(&self) -> impl Iterator<Item = &String>
Sourcepub fn extra_apps(&self) -> Vec<String>
pub fn extra_apps(&self) -> Vec<String>
The workspace names in EXTRA_APPS.
Sourcepub fn essential_services(&self) -> Vec<String>
pub fn essential_services(&self) -> Vec<String>
Compose services enabled under [essentials] (service = true).
Sourcepub fn default_essentials(&self) -> Map<String, Value>
pub fn default_essentials(&self) -> Map<String, Value>
Sensible defaults when a workspace has never declared essentials.
Sourcepub fn ensure_essential(&mut self) -> bool
pub fn ensure_essential(&mut self) -> bool
Add / normalise [essentials]. Returns true when the file should be rewritten.
pub fn save(&self, path: &Path) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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