spectec_ast_decode 1.0.0

Trait for decoding SpecTec AST S-expressions
Documentation
1
2
3
4
5
6
7
8
9
10
11
pub trait Decode: Sized {
    /// Consumes zero or more S-expression items from the iterator to construct `Self`.
    ///
    /// # Errors
    ///
    /// Will return an error if the S-expression cannot be represented by `Self`. To avoid this case,
    /// use `can_decode` to check if the item can be decoded first.
    fn decode<'a, I: Iterator<Item = &'a sexpr_parse::SExprItem>>(
        items: &mut std::iter::Peekable<I>,
    ) -> crate::Result<Self>;
}