All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Adds method
into_buf
forBox<Pointer>
andimpl From<PathBuf> for Box<Pointer>
. - Adds unsafe associated methods
Pointer::new_unchecked
andPointerBuf::new_unchecked
for external zero-cost construction. - Adds
Pointer::starts_with
andPointer::ends_with
for prefix and suffix matching. - Adds new
ParseIndexError
variant to express the presence non-digit characters in the token. - Adds
Token::is_next
for checking if a token represents the-
character.
- Changed signature of
PathBuf::parse
to avoid requiring allocation. - Bumps minimum Rust version to 1.79.
Pointer::get
now accepts ranges and can producePointer
segments as output (similar toslice::get
).
- Make validation of array indices conform to RFC 6901 in the presence of non-digit characters.
- Adds methods
len
andis_empty
toPointer
- Adds fluid methods
with_trailing_token
,with_leading_token
,concat
toPointer
.
Token::to_index
now fails if the token contains leading zeros, as mandated by the RFC.
ParseIndexError
is now an enum to reflect the new failure mode when parsing indices.
- README tweak.
This is a breaking release including:
- New slice type
Pointer
that enables zero-copy usage patterns - New const constructor
const fn Pointer::from_static
for compile-time allocatedPointer
s - Zero-allocation
Pointer::root
singleton pointer - Quickcheck-based testing
- New methods:
Pointer::split_front
,Pointer::split_back
,Pointer::parent
,Pointer::strip_suffix
- Implemented
Display
andDebug
forParseError
- Adds
Pointer::split_at
which utilizes character offsets to split a pointer at a separator - Adds specific error types
ParseError
,ResolveError
,AssignError
- JSON Pointers with leading
"#"
are no longer accepted. Previously, the erroneous leading hashtag was allowed during parsing but discarded. Assign
,Resolve
,ResolveMut
,Delete
all now use associated typesValue
andError
, allowing for more impls other than JSON- Debug implementation now preserves type information (e.g. prints
PathBuf("/foo/bar")
instead of"/foo/bar"
) -Display
remains the same - Original
Pointer
type renamed toPointerBuf
- Error types now use character
offset
indexing instead of owned copies ofPointer
andToken
. Pointer::root
is nowPointerBuf::new
Pointer::new
is nowPointerBuf::from_tokens
(and takes anIntoIterator
argument - arrays still work)Pointer::union
is nowPointerBuf::intersection
Token
type has been simplified and is now by default a borrowed type (useToken::to_owned
orToken::into_owned
to make it owned)Assign::assign
now returnsResult<Option<Assign::Value>, AssignError>
, whereOption<Assign::Value>
is the replaced value
- Fixes #28:
Pointer::union
is misleadingly named
- Removes
Assignment
- Removes
MaybePointer
- Removes
Error
- Removes
impl Deref<Target=&str>
fromPointer
- Removes optional dependencies of
url
,fluent-uri
anduniresid
as well as theTryFrom
implementations for their respective types - Removed
Token::as_key
andToken::as_str
- useToken::decoded().as_ref()
to achieve the same effect - Several redundant or error-prone trait implementations were removed from
Token
- Fixes issue with
pop_front
on a token with an empty string leaving the pointer in an invalid state. #25 by @wngr - Fixes issue with
pop_back
on a token with an empty string. #26 by @asmello
- Fixes
Pointer::last
panicking for empty/root pointers #23 by @wngr
- Fixes issue with
Pointer::push_back
that does not allow for empty strings to be appended as tokens. #21 fixed by @wngr
- Adds
parse
method toPointer
which calls the currently existingFromStr
impl
- implements
IntoIterator
for&Pointer
- implements
Borrow<[u8]>
andAsRef<[u8]>
forPointer
- Adds
CHANGELOG.md
which will be better upkept moving forward. - Adds
MaybePointer
to assist with deserialization which should not fail fast.
Pointer::new
now accepts a generic list, so&["example"]
can be replaced by["example"]
. For untyped, empty slices (i.e.Pointer::new(&[])
), usePointer::default()
.std
is now enabled by default.
- Removes optional
MalformedPointerError
fromPointer
.
- Adds quotes around
Pointer
debug output (#11)
- Adds missing
impl std::error::Error
forError
,NotFoundError
,MalformedError
- Fixes build for
std
feature flag
- Adds feature flag
fluent-uri
forFrom<fluent_uri::Uri<_>
impl (#3)
std
is now optional- Adds feature flags
"uniresid"
,"url"
to enable implementingFrom<Uri>
,From<Url>
(respectively).
- Removes
Cargo.lock
- Makes
uniresid
anduri
optional
- Fixes root pointer representation
""
rather than the erroneous"/"
- Fixes an issue where encoded tokens were not being resolved properly