Removes and returns the last `Token` in the `Pointer` if it exists.
(&mut self)
| 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>> { |
no outgoing calls