pub struct TemplateError {
pub message: Box<str>,
pub location: Location,
/* private fields */
}Expand description
An error produced while compiling or rendering a template.
The location always refers to the original template source
(or the shared main+includes arena).
Fields§
§message: Box<str>A human-readable description of the error.
location: LocationThe location in the original template source where the error occurred.
Implementations§
Source§impl TemplateError
impl TemplateError
Sourcepub fn new(message: impl Into<Box<str>>, location: Location) -> Self
pub fn new(message: impl Into<Box<str>>, location: Location) -> Self
Creates a new error at the given template location.
Sourcepub fn display_with<'s>(&'s self, template: &'s str) -> impl Display + 's
pub fn display_with<'s>(&'s self, template: &'s str) -> impl Display + 's
Renders the error as a caret-marked snippet against the given template source.
If this error carries an attached diagnostic source (e.g. the compile-time arena that
includes loaded bodies), that source is used instead of template.
Trait Implementations§
Source§impl Clone for TemplateError
impl Clone for TemplateError
Source§impl Debug for TemplateError
impl Debug for TemplateError
Source§impl Display for TemplateError
impl Display for TemplateError
impl Eq for TemplateError
Source§impl PartialEq for TemplateError
impl PartialEq for TemplateError
impl StructuralPartialEq for TemplateError
Auto Trait Implementations§
impl Freeze for TemplateError
impl RefUnwindSafe for TemplateError
impl Send for TemplateError
impl Sync for TemplateError
impl Unpin for TemplateError
impl UnsafeUnpin for TemplateError
impl UnwindSafe for TemplateError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.