#[non_exhaustive]pub enum TemplateError {
HoleUnused {
hole: usize,
},
BinderUnbound {
binder: usize,
},
BinderBoundTwice {
binder: usize,
},
LabelUndefined {
label: usize,
},
LabelDefinedTwice {
label: usize,
},
SpliceOutOfList {
hole: usize,
},
ForeignHandle,
TooLarge,
Syntax {
at: Span,
error: SyntaxError,
},
}Expand description
Why a template was refused.
§Examples
use lower_lang::{TemplateBuilder, TemplateError};
let mut t = TemplateBuilder::new("unused");
let _x = t.expr_hole("x");
let root = t.lit(lower_lang::TLit::Null);
assert_eq!(t.finish(root), Err(TemplateError::HoleUnused { hole: 0 }));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
HoleUnused
A declared hole is never used. Use it, or remove it (every hole must receive its user code somewhere, or that code would be lost).
BinderUnbound
A binder is used but no pattern or closure parameter binds it.
BinderBoundTwice
A binder is bound by two patterns or parameters. Declare one binder per binding site.
LabelUndefined
A label is jumped to but no loop or block defines it.
LabelDefinedTwice
A label is defined by two loops or blocks.
SpliceOutOfList
An argument-list hole is spliced somewhere other than a call’s arguments or a tuple’s or array’s elements.
ForeignHandle
A handle from another template builder (or a list longer than the arena) was used.
TooLarge
The tree, counting shared sub-trees at every use, has more than
MAX_TEMPLATE_SIZE nodes, or a table outgrew its index type.
Syntax
A template text (Template::parse) is not valid template syntax:
what is wrong, and the byte range of the text it is about.
Trait Implementations§
Source§impl Clone for TemplateError
impl Clone for TemplateError
impl Copy 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 Error for TemplateError
impl Error for TemplateError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()