macro_rules! install_pretty_helpers {
($allocator:ident : $allocator_type:ty) => { ... };
(@$allocator:ident, $($(#[$($attrs:tt)*])*$name:ident{$($callable:tt)*}),*) => { ... };
}Expand description
Install pretty-printing helpers partially applied with a given local allocator.
This macro declares a set of small, local macros that proxy to the
underlying pretty::DocAllocator methods and macro while capturing your
allocator value. It keeps printing code concise and avoids passing the
allocator around explicitly.
§Syntax
ⓘ
install_pretty_helpers!(alloc_ident: AllocatorType)alloc_ident: the in-scope variable that implements bothpretty::DocAllocatorandPrinter.AllocatorType: the concrete type of that variable.
§What gets installed
- macro shorthands for common allocator methods:
PrettyAstExt::nil,PrettyAstExt::fail,PrettyAstExt::hardline,PrettyAstExt::space,PrettyAstExt::line,PrettyAstExt::line_,PrettyAstExt::softline,PrettyAstExt::softline_,PrettyAstExt::as_string,PrettyAstExt::text,PrettyAstExt::concat,PrettyAstExt::intersperse, [PrettyAstExt::column], [PrettyAstExt::nesting],PrettyAstExt::reflow. - a partially applied version of
pretty::docs!. todo_document!: produce a placeholder document (that does not panic).