#[non_exhaustive]pub struct Profile(/* private fields */);Expand description
A named variant of a project’s variable bindings.
Projects often need different values for the same variable across
environments — for instance, DATABASE_URL differs between development
and production. A Profile lets each project distinguish those variants
without creating duplicate registry entries.
The canonical default profile is named "default". Use
Profile::default_profile to obtain it.
§Examples
use evault_core::model::Profile;
assert!(Profile::default_profile().is_default());
assert_eq!(Profile::try_named("dev").expect("valid").as_str(), "dev");Implementations§
Source§impl Profile
impl Profile
Sourcepub const DEFAULT_NAME: &'static str = "default"
pub const DEFAULT_NAME: &'static str = "default"
The canonical default profile name.
Sourcepub fn default_profile() -> Self
pub fn default_profile() -> Self
Construct the canonical default profile.
Sourcepub fn named(name: impl Into<String>) -> Self
pub fn named(name: impl Into<String>) -> Self
Construct a named profile from already-validated input.
If name == "default", returns Self::default_profile to keep a
single canonical representation. Otherwise the string is stored
verbatim. No validation: use Self::try_named for user input.
Sourcepub fn try_named(name: impl Into<String>) -> Result<Self, ManifestError>
pub fn try_named(name: impl Into<String>) -> Result<Self, ManifestError>
Construct a named profile from possibly-untrusted input.
Accepted names:
- 1 to 32 characters
- ASCII alphanumerics, hyphen, or underscore
- not entirely composed of digits
"default" is normalized to the canonical default profile.
§Errors
Returns ManifestError::Invalid if name violates any of the
rules above.
Sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
Returns true if this is the canonical default profile.