MCPcopy Create free account
hub / github.com/chanced/jsonptr / pop_back

Method pop_back

src/pointer.rs:962–971  ·  view source on GitHub ↗

Removes and returns the last `Token` in the `Pointer` if it exists.

(&mut self)

Source from the content-addressed store, hash-verified

960
961 /// Removes and returns the last `Token` in the `Pointer` if it exists.
962 pub fn pop_back(&mut self) -> Option<Token<'static>> {
963 if let Some(idx) = self.0.rfind('/') {
964 // SAFETY: source pointer is encoded
965 let back = unsafe { Token::from_encoded_unchecked(self.0.split_off(idx + 1)) };
966 self.0.pop(); // remove trailing `/`
967 Some(back)
968 } else {
969 None
970 }
971 }
972
973 /// Removes and returns the first `Token` in the `Pointer` if it exists.
974 pub fn pop_front(&mut self) -> Option<Token<'static>> {

Callers 4

qc_pop_and_pushFunction · 0.80
qc_splitFunction · 0.80

Calls

no outgoing calls