diff --git a/src/token.rs b/src/token.rs index 9772ea6..82305dd 100644 --- a/src/token.rs +++ b/src/token.rs @@ -61,7 +61,7 @@ impl<'a> Token<'a> { /// # use jsonptr::Token; /// assert_eq!(Token::from_encoded("~1foo~1~0bar").unwrap().decoded(), "/foo/~bar"); /// let err = Token::from_encoded("foo/oops~bar").unwrap_err(); - /// assert_eq!(err.offset(), 3); + /// assert_eq!(err.offset, 3); /// ``` /// /// ## Errors @@ -340,13 +340,6 @@ pub struct InvalidEncodingError { pub offset: usize, } -impl InvalidEncodingError { - /// The byte offset of the first invalid `~`. - pub fn offset(&self) -> usize { - self.offset - } -} - impl fmt::Display for InvalidEncodingError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( @@ -462,12 +455,6 @@ mod tests { assert!(Token::from_encoded("a~a").is_err()); } - #[test] - fn invalid_encoding_offset() { - let err = InvalidEncodingError { offset: 3 }; - assert_eq!(err.offset(), 3); - } - #[test] fn into_owned() { let token = Token::from_encoded("foo~0").unwrap().into_owned();