pkenum_core 0.3.1

Core logic for pkenum.
Documentation
use std::error::Error;
use std::fmt::{ Display, Formatter, Result };
use proc_macro2::TokenStream;

/// An error which would occur while parsing from a TokenStream to AST.
#[derive(Debug)]
pub struct ParseError {
    /// The call-site of the parsing error.
    pub tokens: TokenStream,
    pub error: String,
    pub help: String,
}

impl ParseError {
    pub fn new(tokens: TokenStream, error: String, help: String) -> Self {
        ParseError { tokens, error, help }
    }
}

impl Display for ParseError {
    fn fmt(&self, f: &mut Formatter) -> Result {
        write!(f, "{}", self.error)
    }
}

impl Error for ParseError { }