pub struct KdlIdentifier { /* private fields */ }
Expand description
Represents a KDL Identifier.
Implementations§
Source§impl KdlIdentifier
impl KdlIdentifier
Sourcepub fn set_value(&mut self, value: impl Into<String>)
pub fn set_value(&mut self, value: impl Into<String>)
Sets the string value for this identifier.
Sourcepub fn span(&self) -> SourceSpan
Available on crate feature span
only.
pub fn span(&self) -> SourceSpan
span
only.Gets this identifier’s span.
This value will be properly initialized when created via crate::KdlDocument::parse
but may become invalidated if the document is mutated. We do not currently
guarantee this to yield any particularly consistent results at that point.
Sourcepub fn set_span(&mut self, span: impl Into<SourceSpan>)
Available on crate feature span
only.
pub fn set_span(&mut self, span: impl Into<SourceSpan>)
span
only.Sets this identifier’s span.
Sourcepub fn repr(&self) -> Option<&str>
pub fn repr(&self) -> Option<&str>
Gets the custom string representation for this identifier, if any.
Sourcepub fn set_repr(&mut self, repr: impl Into<String>)
pub fn set_repr(&mut self, repr: impl Into<String>)
Sets a custom string representation for this identifier.
Sourcepub fn clear_format(&mut self)
pub fn clear_format(&mut self)
Resets this identifier to its default representation. It will attempt to make it an unquoted identifier, and fall back to a string representation if that would be invalid.
Sourcepub fn autoformat(&mut self)
pub fn autoformat(&mut self)
Auto-formats this identifier.
Sourcepub fn parse(s: &str) -> Result<Self, KdlError>
pub fn parse(s: &str) -> Result<Self, KdlError>
Parses a string into a entry.
If the v1-fallback
feature is enabled, this method will first try to
parse the string as a KDL v2 entry, and, if that fails, it will try
to parse again as a KDL v1 entry. If both fail, only the v2 parse
errors will be returned.
Trait Implementations§
Source§impl Clone for KdlIdentifier
impl Clone for KdlIdentifier
Source§fn clone(&self) -> KdlIdentifier
fn clone(&self) -> KdlIdentifier
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for KdlIdentifier
impl Debug for KdlIdentifier
Source§impl Display for KdlIdentifier
impl Display for KdlIdentifier
Source§impl From<&str> for KdlIdentifier
impl From<&str> for KdlIdentifier
Source§impl From<KdlIdentifier> for KdlIdentifier
Available on crate feature v1
only.
impl From<KdlIdentifier> for KdlIdentifier
v1
only.