Enum r_shquote::UnquoteError
source · pub enum UnquoteError {
UnterminatedSingleQuote {
char_cursor: usize,
byte_cursor: usize,
},
UnterminatedDoubleQuote {
char_cursor: usize,
byte_cursor: usize,
},
}
Expand description
Error information for unquote operations
This error contains diagnostics from an unquote-operation. In particular, it contains the character and byte offsets of the cursor where the error originated.
Examples
let quote = "'Hello' 'World!";
let res = r_shquote::unquote(quote).unwrap_err();
match res {
r_shquote::UnquoteError::UnterminatedSingleQuote { char_cursor: x, .. } |
r_shquote::UnquoteError::UnterminatedDoubleQuote { char_cursor: x, .. } => {
println!("Input: {}", quote);
println!(" {}^--- unterminated quote", " ".repeat(x));
},
}
Variants
UnterminatedSingleQuote
UnterminatedDoubleQuote
Trait Implementations
sourceimpl Clone for UnquoteError
impl Clone for UnquoteError
sourcefn clone(&self) -> UnquoteError
fn clone(&self) -> UnquoteError
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for UnquoteError
impl Debug for UnquoteError
sourceimpl Display for UnquoteError
impl Display for UnquoteError
sourceimpl Error for UnquoteError
impl Error for UnquoteError
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations
impl RefUnwindSafe for UnquoteError
impl Send for UnquoteError
impl Sync for UnquoteError
impl Unpin for UnquoteError
impl UnwindSafe for UnquoteError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more