Skip to content

Commit

Permalink
update signature of PathBuf::parse (#77)
Browse files Browse the repository at this point in the history
* update signature of PathBuf::parse
  • Loading branch information
asmello authored Oct 18, 2024
1 parent ccef032 commit 6630744
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Bumps minimum Rust version to 1.79
- Changed signature of `PathBuf::parse` to avoid requiring allocation.
- Bumps minimum Rust version to 1.79.

## [0.6.2] 2024-09-30

Expand Down
6 changes: 4 additions & 2 deletions src/pointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -877,8 +877,10 @@ impl PointerBuf {
///
/// ## Errors
/// Returns a [`ParseError`] if the string is not a valid JSON Pointer.
pub fn parse<S: AsRef<str> + ?Sized>(s: &S) -> Result<Self, ParseError> {
Pointer::parse(&s).map(Pointer::to_buf)
pub fn parse(s: impl Into<String>) -> Result<Self, ParseError> {
let s = s.into();
validate(&s)?;
Ok(Self(s))
}

/// Creates a new `PointerBuf` from a slice of non-encoded strings.
Expand Down

0 comments on commit 6630744

Please sign in to comment.