pub enum Error<'a, E> {
UnclosedRegion {
source: &'a str,
range: Range<usize>,
},
UnexpectedClosingBrace {
index: usize,
},
UnexpectedOpeningBrace {
index: usize,
},
BadReplacement {
key: &'a str,
range: Range<usize>,
error: E,
},
WriteFailed(Error),
}
Expand description
Any error that occurs when filling a template string.
Template parsing and filling is all done in a single pass; so a failed replacement due to an unknown key will shadow a syntax error later in the string.
Variants§
UnclosedRegion
A template region was not closed.
That is, an opening curly brace ({
) with no matching closing curly brace (}
).
Example:
"Hello, {thing"
Fields
UnexpectedClosingBrace
An unescaped closing curly brace (}
) was found, outside a template region.
Examples:
"Hello, thing}!"
"Hello, {name}, look at my magnificent moustache: (}-:"
"Hello, {name}}!"
UnexpectedOpeningBrace
An opening curly brace ({
) was found within a template region.
Examples:
"Hello, {thing{{sadness}}}"
BadReplacement
The filler returned an error for the specified key.
Fields
§
error: E
The error value returned by the filler.
WriteFailed(Error)
Writing to the output failed.
Trait Implementations§
Source§impl<'a, E> Error for Error<'a, E>where
E: Error + 'static,
Available on crate feature std
only.
impl<'a, E> Error for Error<'a, E>where
E: Error + 'static,
Available on crate feature
std
only.Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns 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()
impl<'a, E: Eq> Eq for Error<'a, E>
impl<'a, E> StructuralPartialEq for Error<'a, E>
Auto Trait Implementations§
impl<'a, E> Freeze for Error<'a, E>where
E: Freeze,
impl<'a, E> RefUnwindSafe for Error<'a, E>where
E: RefUnwindSafe,
impl<'a, E> Send for Error<'a, E>where
E: Send,
impl<'a, E> Sync for Error<'a, E>where
E: Sync,
impl<'a, E> Unpin for Error<'a, E>where
E: Unpin,
impl<'a, E> UnwindSafe for Error<'a, E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more