include_tt 1.1.1

Macros for ultra-flexible injection of token trees, literals, or binary data into Rust code from external files during compilation.
Documentation
use proc_macro2::TokenStream as TokenStream2;

/// The most common `Result`,
/// but with a default function to select the error, not the value.
#[derive(Debug)]
pub enum TreeResult<Ok> {
    /// An error has occurred and the entire parser must be aborted.
    Err(TokenStream2),
    /// The result of a successful operation.
    Ok(Ok),
}

impl<T> From<TokenStream2> for TreeResult<T> {
    #[inline]
    fn from(e: TokenStream2) -> Self {
        Self::Err(e)
    }
}

/// The functionality repeats the `?` operator, but is written for `TreeResult`.
// TODO! Requires `try` stabilization from std.
macro_rules! tq {
	[ $e: expr ] => {
		match $e {
			TreeResult::Ok(a) => a,
			TreeResult::Err(e) => return e.into(),
		}
	};
}