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§
Trait Implementations§
source§impl Clone for UnquoteError
impl Clone for UnquoteError
source§fn clone(&self) -> UnquoteError
fn clone(&self) -> UnquoteError
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for UnquoteError
impl Debug for UnquoteError
source§impl Display for UnquoteError
impl Display for UnquoteError
source§impl Error for UnquoteError
impl Error for UnquoteError
1.30.0 · source§fn 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 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()