pub struct CapabilityId(/* private fields */);Expand description
Capability identifier — an open, string-based ID.
IDs are open strings rather than variants in a central enum, so new
capabilities can be added without database migrations or Everruns source
edits. A stable identifier is made from ASCII letters, digits, _, -,
., or :, starts with a letter or _, and fits within 128 bytes; the
__everruns_ namespace is reserved.
CapabilityId::new is infallible so persisted and in-flight values can
be carried without re-validation; boundaries that accept new identifiers
(Framework agent build, product write paths) enforce the grammar with
validate_capability_id / CapabilityId::validate or the validating
FromStr implementation.
Implementations§
Source§impl CapabilityId
impl CapabilityId
Sourcepub fn new(id: impl Into<String>) -> Self
pub fn new(id: impl Into<String>) -> Self
Create a capability ID from a string without validating it.
Use this for values that were already validated at a boundary (or that
predate validation). New identifiers should go through
CapabilityId::parse or a boundary that calls
validate_capability_id.
Sourcepub fn parse(id: impl Into<String>) -> Result<Self, CapabilityError>
pub fn parse(id: impl Into<String>) -> Result<Self, CapabilityError>
Create a validated capability ID.
Sourcepub fn validate(&self) -> Result<(), CapabilityError>
pub fn validate(&self) -> Result<(), CapabilityError>
Validate this ID against the open-ID grammar and reserved namespaces.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consume the ID and return the underlying string.
Trait Implementations§
Source§impl AsRef<str> for CapabilityId
impl AsRef<str> for CapabilityId
Source§impl Borrow<str> for CapabilityId
impl Borrow<str> for CapabilityId
Source§impl Clone for CapabilityId
impl Clone for CapabilityId
Source§fn clone(&self) -> CapabilityId
fn clone(&self) -> CapabilityId
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more