pub struct KdlEntry { /* private fields */ }
Expand description
Implementations
sourceimpl KdlEntry
impl KdlEntry
sourcepub fn name(&self) -> Option<&KdlIdentifier>
pub fn name(&self) -> Option<&KdlIdentifier>
Gets a reference to this entry’s name, if it’s a property entry.
sourcepub fn span(&self) -> &SourceSpan
pub fn span(&self) -> &SourceSpan
Gets this entry’s span.
This value will be properly initialized when created via [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 span_mut(&mut self) -> &mut SourceSpan
pub fn span_mut(&mut self) -> &mut SourceSpan
Gets a mutable reference to this entry’s span.
sourcepub fn set_span(&mut self, span: impl Into<SourceSpan>)
pub fn set_span(&mut self, span: impl Into<SourceSpan>)
Sets this entry’s span.
sourcepub fn ty(&self) -> Option<&KdlIdentifier>
pub fn ty(&self) -> Option<&KdlIdentifier>
Gets the entry’s type.
sourcepub fn ty_mut(&mut self) -> Option<&mut KdlIdentifier>
pub fn ty_mut(&mut self) -> Option<&mut KdlIdentifier>
Gets a mutable reference to this entry’s type.
sourcepub fn set_ty(&mut self, ty: impl Into<KdlIdentifier>)
pub fn set_ty(&mut self, ty: impl Into<KdlIdentifier>)
Sets the entry’s type.
sourcepub fn new_prop(
key: impl Into<KdlIdentifier>,
value: impl Into<KdlValue>
) -> Self
pub fn new_prop(
key: impl Into<KdlIdentifier>,
value: impl Into<KdlValue>
) -> Self
Creates a new Property (key/value) KdlEntry.
sourcepub fn leading(&self) -> Option<&str>
pub fn leading(&self) -> Option<&str>
Gets leading text (whitespace, comments) for this KdlEntry.
sourcepub fn set_leading(&mut self, leading: impl Into<String>)
pub fn set_leading(&mut self, leading: impl Into<String>)
Sets leading text (whitespace, comments) for this KdlEntry.
sourcepub fn trailing(&self) -> Option<&str>
pub fn trailing(&self) -> Option<&str>
Gets trailing text (whitespace, comments) for this KdlEntry.
sourcepub fn set_trailing(&mut self, trailing: impl Into<String>)
pub fn set_trailing(&mut self, trailing: impl Into<String>)
Sets trailing text (whitespace, comments) for this KdlEntry.
sourcepub fn clear_fmt(&mut self)
pub fn clear_fmt(&mut self)
Clears leading and trailing text (whitespace, comments), as well as resetting this entry’s value to its default representation.
sourcepub fn value_repr(&self) -> Option<&str>
pub fn value_repr(&self) -> Option<&str>
Gets the custom string representation for this KdlEntry’s KdlValue
.
sourcepub fn set_value_repr(&mut self, repr: impl Into<String>)
pub fn set_value_repr(&mut self, repr: impl Into<String>)
Sets a custom string representation for this KdlEntry’s KdlValue
.