| 1 | //! display_list module stores the output model for the snippet. |
| 2 | //! |
| 3 | //! `DisplayList` is a central structure in the crate, which contains |
| 4 | //! the structured list of lines to be displayed. |
| 5 | //! |
| 6 | //! It is made of two types of lines: `Source` and `Raw`. All `Source` lines |
| 7 | //! are structured using four columns: |
| 8 | //! |
| 9 | //! ```text |
| 10 | //! /------------ (1) Line number column. |
| 11 | //! | /--------- (2) Line number column delimiter. |
| 12 | //! | | /------- (3) Inline marks column. |
| 13 | //! | | | /--- (4) Content column with the source and annotations for slices. |
| 14 | //! | | | | |
| 15 | //! ============================================================================= |
| 16 | //! error[E0308]: mismatched types |
| 17 | //! --> src/format.rs:51:5 |
| 18 | //! | |
| 19 | //! 151 | / fn test() -> String { |
| 20 | //! 152 | | return "test"; |
| 21 | //! 153 | | } |
| 22 | //! | |___^ error: expected `String`, for `&str`. |
| 23 | //! | |
| 24 | //! ``` |
| 25 | //! |
| 26 | //! The first two lines of the example above are `Raw` lines, while the rest |
| 27 | //! are `Source` lines. |
| 28 | //! |
| 29 | //! `DisplayList` does not store column alignment information, and those are |
| 30 | //! only calculated by the implementation of `std::fmt::Display` using information such as |
| 31 | //! styling. |
| 32 | //! |
| 33 | //! The above snippet has been built out of the following structure: |
| 34 | mod from_snippet; |
| 35 | mod structs; |
| 36 | |
| 37 | pub use self::structs::*; |
| 38 | |