# `or_gen` Proc Macro Documentation A proc macro that converts `if` or `match` expressions that return multiple types into [Or](../or/trait.Or.html) types. ## Usage Examples ### For `if` Expression ```rust #![feature(proc_macro_hygiene)] use or_rs_macros::or_gen; use or_rs::enums::Or3; #[or_gen] // Add a type annotation explicitly let s: Or3 = if true { 3 } else if false { "hello".to_string() } else { 3.0 }; ``` ### For `match` Expression ```rust #![feature(proc_macro_hygiene)] use or_rs_macros::or_gen; use or_rs::enums::Or3; #[or_gen] // Add a type annotation explicitly let s: Or3 = match 42 { 1 => 22, 10 => 3.2, _ => "hello".to_string(), }; ``` ## Function Definition ```rust #[proc_macro_attribute] pub fn or_gen(_attr: TokenStream, item: TokenStream) -> TokenStream { parser::MacroParser::parse(item) } ```