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

Method split_back

src/pointer.rs:242–251  ·  view source on GitHub ↗

Splits the `Pointer` into the parent path and the last `Token`.

(&self)

Source from the content-addressed store, hash-verified

240
241 /// Splits the `Pointer` into the parent path and the last `Token`.
242 pub fn split_back(&self) -> Option<(&Self, Token)> {
243 self.0.rsplit_once('/').map(|(front, back)| {
244 (
245 // SAFETY: we split at a token boundary, so front is a valid pointer
246 unsafe { Self::new_unchecked(front) },
247 // SAFETY: source token is encoded
248 unsafe { Token::from_encoded_unchecked(back) },
249 )
250 })
251 }
252
253 /// A pointer to the parent of the current path.
254 pub fn parent(&self) -> Option<&Self> {

Callers 3

expandFunction · 0.80
qc_splitFunction · 0.80
deleteMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected