macro_rules! parse_ts_macro_input {
($input:ident as $ty:ty) => { ... };
($input:ident) => { ... };
}Expand description
Parse a TsStream into a DeriveInput, returning early with an error MacroResult on failure.
This macro is analogous to syn::parse_macro_input! and provides ergonomic error handling
for derive macros.
§Example
ⓘ
use ts_syn::{parse_ts_macro_input, DeriveInput};
use ts_syn::MacroResult;
#[ts_macro_derive(MyMacro)]
pub fn my_macro(mut input: TsStream) -> MacroResult {
let input = parse_ts_macro_input!(input as DeriveInput);
// input is now a DeriveInput
let name = input.name();
// ...
}§Variants
parse_ts_macro_input!(stream as DeriveInput)- Parse as DeriveInputparse_ts_macro_input!(stream)- Same as above (DeriveInput is the default)