Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improves lendocs #72

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 2 additions & 31 deletions src/pointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// ```
Expand Down Expand Up @@ -832,35 +832,6 @@ impl PointerBuf {
self
}

// 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.
///
/// ## 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<Token<'t>>) {
self.0.insert(0, '/');
Expand Down
Loading