Struct tree_sitter_graph::graph::Attributes
source · pub struct Attributes { /* private fields */ }Expand description
A set of attributes associated with a graph node or edge
Implementations§
source§impl Attributes
impl Attributes
sourcepub fn new() -> Attributes
pub fn new() -> Attributes
Creates a new, empty set of attributes.
sourcepub fn add<V: Into<Value>>(
&mut self,
name: Identifier,
value: V
) -> Result<(), ()>
pub fn add<V: Into<Value>>( &mut self, name: Identifier, value: V ) -> Result<(), ()>
Adds an attribute to this attribute set. If there was already an attribute with the same
name, replaces its value and returns Err.
sourcepub fn get<Q>(&self, name: &Q) -> Option<&Value>where
Q: ?Sized + Eq + Hash,
Identifier: Borrow<Q>,
pub fn get<Q>(&self, name: &Q) -> Option<&Value>where Q: ?Sized + Eq + Hash, Identifier: Borrow<Q>,
Returns the value of a particular attribute, if it exists.