From 931fe059c67d4e2e14cef37c9ccec382454ad6bf Mon Sep 17 00:00:00 2001 From: Chance Date: Mon, 30 Sep 2024 16:12:28 -0400 Subject: [PATCH 1/2] improves `len`docs --- src/pointer.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pointer.rs b/src/pointer.rs index 36ec4e1..4821f46 100644 --- a/src/pointer.rs +++ b/src/pointer.rs @@ -486,8 +486,8 @@ impl Pointer { // Returns the length of `self` in encoded format. /// - /// This length is in bytes, not [`char`]s or graphemes. In other words, it might - /// not be what a human considers the length of the string. + /// This length expresses the byte count of the underlying string that + /// represents the RFC 6091 Pointer. See also [`std::str::len`]. /// /// ## Examples /// ``` @@ -834,8 +834,8 @@ impl PointerBuf { // Returns the length of `self` in encoded format. /// - /// This length is in bytes, not [`char`]s or graphemes. In other words, it might - /// not be what a human considers the length of the string. + /// This length expresses the byte count of the underlying string that + /// represents the RFC 6091 Pointer. See also [`std::str::len`]. /// /// ## Examples /// ``` From a5ec76c96ef0d5bdb113d52aace2de533a8b9f74 Mon Sep 17 00:00:00 2001 From: Chance Date: Tue, 1 Oct 2024 14:11:50 -0400 Subject: [PATCH 2/2] removes `len` and `is_empty` from `PointerBuf` --- src/pointer.rs | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/src/pointer.rs b/src/pointer.rs index 4821f46..120534b 100644 --- a/src/pointer.rs +++ b/src/pointer.rs @@ -832,35 +832,6 @@ impl PointerBuf { self } - // Returns the length of `self` in encoded format. - /// - /// This length expresses the byte count of the underlying string that - /// represents the RFC 6091 Pointer. See also [`std::str::len`]. - /// - /// ## Examples - /// ``` - /// let ptr = jsonptr::Pointer::from_static("/foo/bar"); - /// assert_eq!(ptr.len(), 8); - /// - /// ``` - pub fn len(&self) -> usize { - self.0.len() - } - - /// Returns `true` if the `Pointer` is empty (i.e. root). - /// - /// ## Examples - /// ``` - /// let mut ptr = jsonptr::PointerBuf::new(); - /// assert!(ptr.is_empty()); - /// - /// ptr.push_back("foo"); - /// assert!(!ptr.is_empty()); - /// ``` - pub fn is_empty(&self) -> bool { - self.0.is_empty() - } - /// Pushes a `Token` onto the front of this `Pointer`. pub fn push_front<'t>(&mut self, token: impl Into>) { self.0.insert(0, '/');