Fix #343
This commit is contained in:
parent
e9fb053dae
commit
997faa9c71
|
@ -187,7 +187,8 @@ impl<'a> QueryPathNode<'a> {
|
||||||
///
|
///
|
||||||
/// This traverses all the parents of the node until it finds one that is a field name.
|
/// This traverses all the parents of the node until it finds one that is a field name.
|
||||||
pub fn field_name(&self) -> &str {
|
pub fn field_name(&self) -> &str {
|
||||||
self.parents()
|
std::iter::once(self)
|
||||||
|
.chain(self.parents())
|
||||||
.find_map(|node| match node.segment {
|
.find_map(|node| match node.segment {
|
||||||
QueryPathSegment::Name(name) => Some(name),
|
QueryPathSegment::Name(name) => Some(name),
|
||||||
QueryPathSegment::Index(_) => None,
|
QueryPathSegment::Index(_) => None,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user