Skip to content

Commit

Permalink
Rename fn to more concrete unquoted_jsonpath_segments()
Browse files Browse the repository at this point in the history
  • Loading branch information
azoyan committed Dec 25, 2024
1 parent a649a76 commit ef4bb4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions crates/rsonpath-lib/src/automaton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ impl Automaton {
self[state].attributes.is_unitary()
}

/// Returns JSONPath segments as strings from an Automation instance
/// Returns JSONPath segments as unquoted strings from an Automation instance
///
/// It traverses the states and transitions of the internal automaton to collect the unquoted patterns representing the individual components of the JSONPath query.
/// # Example
Expand All @@ -403,7 +403,7 @@ impl Automaton {
/// ```
#[must_use]
#[inline(always)]
pub fn get_jsonpath_segments(&self) -> Vec<String> {
pub fn unquoted_jsonpath_segments(&self) -> Vec<String> {
self.states
.iter()
.flat_map(|state| {
Expand Down
8 changes: 4 additions & 4 deletions crates/rsonpath-lib/src/engine/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,23 +195,23 @@ impl Engine for MainEngine {
}

impl MainEngine {
/// Returns JSONPath segments as strings from an MainEngine instance
/// Returns JSONPath segments as unquoted strings from an MainEngine instance
///
/// It traverses the states and transitions of the internal automaton to collect the unquoted patterns representing the individual components of the JSONPath query.
/// # Example
/// ```rust
/// use rsonpath::automaton::*;
/// let path = "$.personal.details.contact.information.phones.home";
/// let automation = Automaton::new(&rsonpath_syntax::parse(path).unwrap()).unwrap();
/// let engine = RsonpathEngine::from_compiled_query(a)
/// let engine = RsonpathEngine::from_compiled_query(a);
/// let jsonpath_strings = engine.get_jsonpath_segments();
///
/// println!("{:?}", jsonpath_strings); // ["personal", "details", "contact", "information", "phones", "home"]
/// ```
#[must_use]
#[inline]
pub fn get_jsonpath_segments(&self) -> Vec<String> {
self.automaton.get_jsonpath_segments()
pub fn unquoted_jsonpath_segments(&self) -> Vec<String> {
self.automaton.unquoted_jsonpath_segments()
}
}

Expand Down

0 comments on commit ef4bb4f

Please sign in to comment.