#[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,
}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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
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.
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)>
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()
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