1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
#[derive(Debug, Clone, PartialEq)] pub struct DisplayList { pub body: Vec<DisplayLine>, } impl From<Vec<DisplayLine>> for DisplayList { fn from(body: Vec<DisplayLine>) -> Self { Self { body } } } #[derive(Debug, Clone, PartialEq)] pub struct Annotation { pub annotation_type: DisplayAnnotationType, pub id: Option<String>, pub label: Vec<DisplayTextFragment>, } #[derive(Debug, Clone, PartialEq)] pub enum DisplayLine { Source { lineno: Option<usize>, inline_marks: Vec<DisplayMark>, line: DisplaySourceLine, }, Fold { inline_marks: Vec<DisplayMark>, }, Raw(DisplayRawLine), } #[derive(Debug, Clone, PartialEq)] pub enum DisplaySourceLine { Content { text: String, range: (usize, usize), }, Annotation { annotation: Annotation, range: (usize, usize), annotation_type: DisplayAnnotationType, annotation_part: DisplayAnnotationPart, }, Empty, } #[derive(Debug, Clone, PartialEq)] pub enum DisplayRawLine { Origin { path: String, pos: Option<(usize, usize)>, header_type: DisplayHeaderType, }, Annotation { annotation: Annotation, source_aligned: bool, continuation: bool, }, } #[derive(Debug, Clone, PartialEq)] pub struct DisplayTextFragment { pub content: String, pub style: DisplayTextStyle, } #[derive(Debug, Clone, Copy, PartialEq)] pub enum DisplayTextStyle { Regular, Emphasis, } #[derive(Debug, Clone, PartialEq)] pub enum DisplayAnnotationPart { Standalone, LabelContinuation, Consequitive, MultilineStart, MultilineEnd, } #[derive(Debug, Clone, PartialEq)] pub struct DisplayMark { pub mark_type: DisplayMarkType, pub annotation_type: DisplayAnnotationType, } #[derive(Debug, Clone, PartialEq)] pub enum DisplayMarkType { AnnotationThrough, AnnotationStart, } #[derive(Debug, Clone, PartialEq)] pub enum DisplayAnnotationType { None, Error, Warning, Info, Note, Help, } #[derive(Debug, Clone, PartialEq)] pub enum DisplayHeaderType { Initial, Continuation, }