Macro stackbox::stackbox [−][src]
macro_rules! stackbox { ( // Same as `StackBox::new_in`, except for it allowing an unsized // coercion to take place. $place:expr, $value:expr $(,)? ) => { ... }; ( // Create a new `mut` `StackBox` without mentioning the backing _slot_: // `let mut <binding> = stackbox!($expr);` // Examples: // - `stackbox!(let mut new_var = <expr>);` // - `stackbox!(let mut new_var: StackBox<[_]> = <array expr>);` let mut $var:ident $(: $T:ty)? = $expr:expr ) => { ... }; ( // Create a new `StackBox` without mentioning the backing _slot_: // `let <binding> = stackbox!($expr);` // Examples: // - `stackbox!(let new_var = <expr>);` // - `stackbox!(let new_var: StackBox<[_]> = <array expr>);` let $var:ident $(: $T:ty)? = $expr:expr ) => { ... }; ( // Internal-ish: assign the result of a `stackbox!($expr)` to "some place" // where "some place" may be a new `let` binding or an actual assignment. // // No need to explicitly mention the backing _slot_ either. // Examples: // - `let var: Ty; stackbox!(<expr> => var);` $expr:expr => $($binding:tt)* ) => { ... }; ( // Shorthand for `stackbox!(let mut $var = $var)` let mut $var:ident ) => { ... }; ( // Shorthand for `stackbox!(let $var = $var)` let $var:ident ) => { ... }; ( // To be used as a temporary fed to a function parameter, or as a // `[::with_locals::with]` "return" value. // // Examples: // - `fun(stackbox!(value))` $expr:expr ) => { ... }; }
Convenience macro for more ergonomic StackBox
constructions.