pub struct DiagnosticCode(pub String);Expand description
A stable dotted diagnostic code, e.g. EMIT.BMOPF.TRANSFORMER_UNSUPPORTED.
The grammar is NAMESPACE.SCOPE.SPECIFIC: uppercase ASCII letters, digits
and _ inside a segment, . between segments, at least three segments. A
large scope may use more (EMIT.BMOPF.TRANSFORMER.TAP_COLLAPSED), so a
consumer reads the first segment and treats the rest as opaque identity.
The first segment is the namespace and names the stage the finding came
from; DiagnosticStage decodes it. A code carried by a document powerio
did not write may use a namespace outside the ten, which is data rather than
a failure.
Tuple Fields§
§0: StringImplementations§
Source§impl DiagnosticCode
impl DiagnosticCode
pub fn new(code: impl Into<String>) -> Self
Sourcepub fn namespace(&self) -> &str
pub fn namespace(&self) -> &str
The leading dotted segment (the namespace), e.g. EMIT for
EMIT.PSSE.FIELD_DROPPED.
Sourcepub fn stage(&self) -> Option<DiagnosticStage>
pub fn stage(&self) -> Option<DiagnosticStage>
The stage this code names, or None when the namespace is outside the
ten powerio emits.
pub fn as_str(&self) -> &str
Sourcepub fn is_well_formed(&self) -> bool
pub fn is_well_formed(&self) -> bool
Whether this code matches the grammar. Nothing refuses a code that does not; the registry gates check it so a new code cannot be minted malformed.
Trait Implementations§
Source§impl Clone for DiagnosticCode
impl Clone for DiagnosticCode
Source§fn clone(&self) -> DiagnosticCode
fn clone(&self) -> DiagnosticCode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DiagnosticCode
impl Debug for DiagnosticCode
Source§impl<'de> Deserialize<'de> for DiagnosticCode
impl<'de> Deserialize<'de> for DiagnosticCode
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>,
Source§impl Display for DiagnosticCode
impl Display for DiagnosticCode
impl Eq for DiagnosticCode
Source§impl From<&str> for DiagnosticCode
impl From<&str> for DiagnosticCode
Source§impl From<String> for DiagnosticCode
impl From<String> for DiagnosticCode
Source§impl Hash for DiagnosticCode
impl Hash for DiagnosticCode
Source§impl JsonSchema for DiagnosticCode
impl JsonSchema for DiagnosticCode
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more