Skip to content

Commit

Permalink
Change labels and type to return &str instead of strings
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwalker committed Aug 4, 2023
1 parent c5ee233 commit 35b04da
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/src/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ impl Node {
}

/// various labels attached to this node
pub fn labels(&self) -> Vec<String> {
self.inner.labels.iter().map(|l| l.to_string()).collect()
pub fn labels(&self) -> Vec<&str> {
self.to::<crate::Labels<_>>().unwrap().0
}

/// Get the names of the attributes of this node
Expand Down Expand Up @@ -185,8 +185,8 @@ impl Relation {
self.inner.end_node_id.value
}

pub fn typ(&self) -> String {
self.inner.typ.value.clone()
pub fn typ(&self) -> &str {
self.to::<crate::Type<_>>().unwrap().0
}

/// Get the names of the attributes of this relationship
Expand Down Expand Up @@ -216,8 +216,8 @@ impl UnboundedRelation {
self.inner.id.value
}

pub fn typ(&self) -> String {
self.inner.typ.value.clone()
pub fn typ(&self) -> &str {
self.to::<crate::Type<_>>().unwrap().0
}

/// Get the names of the attributes of this relationship
Expand Down

0 comments on commit 35b04da

Please sign in to comment.