|0.0.1||Apr 6, 2023|
|0.0.0||Jan 26, 2022|
#28 in #toolchain
41 downloads per month
Used in 2 crates
Infrastructure for code formatting
This module defines [FormatElement], an IR to format code documents and provides a mean to print such a document to a string. Objects that know how to format themselves implement the [Format] trait.
- [Format]: Implemented by objects that can be formatted.
- [FormatRule]: Rule that knows how to format an object of another type. Necessary in the situation where it's necessary to implement [Format] on an object from another crate. This module defines the [FormatRefWithRule] and [FormatOwnedWithRule] structs to pass an item with its corresponding rule.
- [FormatWithRule] implemented by objects that know how to format another type. Useful for implementing some reusable formatting logic inside of this module if the type itself doesn't implement [Format]
This crate defines two macros to construct the IR. These are inspired by Rust's