[][src]Macro stakker::CX

macro_rules! CX {
    () => { ... };
    ($other:ty) => { ... };
}

Shorthand for context argument type

Usually (for Rust 2018 edition) the context argument must be written cx: &mut Cx<'_, Self>. Using this macro it can instead be written cx: CX![]. This reduces the boilerplate, but keeps everything else as plain Rust. (The alternative would be to try to wrap the whole method in a macro or use procedural macros.)

Note that sometimes you'll need a context with a different type than Self, in which case cx: CX![OtherType] may be used, equivalent to cx: &mut Cx<'_, OtherType>.