@@ -5,13 +5,13 @@ use rustc_macros::{Decodable, Encodable};
55use crate :: { Level , Loc } ;
66
77#[ derive( Clone , Debug , PartialOrd , Ord , PartialEq , Eq ) ]
8- pub struct Line {
8+ pub ( crate ) struct Line {
99 pub line_index : usize ,
1010 pub annotations : Vec < Annotation > ,
1111}
1212
1313#[ derive( Clone , Copy , Debug , PartialOrd , Ord , PartialEq , Eq , Default ) ]
14- pub struct AnnotationColumn {
14+ pub ( crate ) struct AnnotationColumn {
1515 /// the (0-indexed) column for *display* purposes, counted in characters, not utf-8 bytes
1616 pub display : usize ,
1717 /// the (0-indexed) column in the file, counted in characters, not utf-8 bytes.
@@ -31,13 +31,13 @@ pub struct AnnotationColumn {
3131}
3232
3333impl AnnotationColumn {
34- pub fn from_loc ( loc : & Loc ) -> AnnotationColumn {
34+ pub ( crate ) fn from_loc ( loc : & Loc ) -> AnnotationColumn {
3535 AnnotationColumn { display : loc. col_display , file : loc. col . 0 }
3636 }
3737}
3838
3939#[ derive( Clone , Debug , PartialOrd , Ord , PartialEq , Eq ) ]
40- pub struct MultilineAnnotation {
40+ pub ( crate ) struct MultilineAnnotation {
4141 pub depth : usize ,
4242 pub line_start : usize ,
4343 pub line_end : usize ,
@@ -49,19 +49,19 @@ pub struct MultilineAnnotation {
4949}
5050
5151impl MultilineAnnotation {
52- pub fn increase_depth ( & mut self ) {
52+ pub ( crate ) fn increase_depth ( & mut self ) {
5353 self . depth += 1 ;
5454 }
5555
5656 /// Compare two `MultilineAnnotation`s considering only the `Span` they cover.
57- pub fn same_span ( & self , other : & MultilineAnnotation ) -> bool {
57+ pub ( crate ) fn same_span ( & self , other : & MultilineAnnotation ) -> bool {
5858 self . line_start == other. line_start
5959 && self . line_end == other. line_end
6060 && self . start_col == other. start_col
6161 && self . end_col == other. end_col
6262 }
6363
64- pub fn as_start ( & self ) -> Annotation {
64+ pub ( crate ) fn as_start ( & self ) -> Annotation {
6565 Annotation {
6666 start_col : self . start_col ,
6767 end_col : AnnotationColumn {
@@ -76,7 +76,7 @@ impl MultilineAnnotation {
7676 }
7777 }
7878
79- pub fn as_end ( & self ) -> Annotation {
79+ pub ( crate ) fn as_end ( & self ) -> Annotation {
8080 Annotation {
8181 start_col : AnnotationColumn {
8282 // these might not correspond to the same place anymore,
@@ -91,7 +91,7 @@ impl MultilineAnnotation {
9191 }
9292 }
9393
94- pub fn as_line ( & self ) -> Annotation {
94+ pub ( crate ) fn as_line ( & self ) -> Annotation {
9595 Annotation {
9696 start_col : Default :: default ( ) ,
9797 end_col : Default :: default ( ) ,
@@ -103,7 +103,7 @@ impl MultilineAnnotation {
103103}
104104
105105#[ derive( Clone , Debug , PartialOrd , Ord , PartialEq , Eq ) ]
106- pub enum AnnotationType {
106+ pub ( crate ) enum AnnotationType {
107107 /// Annotation under a single line of code
108108 Singleline ,
109109
@@ -129,7 +129,7 @@ pub enum AnnotationType {
129129}
130130
131131#[ derive( Clone , Debug , PartialOrd , Ord , PartialEq , Eq ) ]
132- pub struct Annotation {
132+ pub ( crate ) struct Annotation {
133133 /// Start column.
134134 /// Note that it is important that this field goes
135135 /// first, so that when we sort, we sort orderings by start
@@ -152,12 +152,12 @@ pub struct Annotation {
152152
153153impl Annotation {
154154 /// Whether this annotation is a vertical line placeholder.
155- pub fn is_line ( & self ) -> bool {
155+ pub ( crate ) fn is_line ( & self ) -> bool {
156156 matches ! ( self . annotation_type, AnnotationType :: MultilineLine ( _) )
157157 }
158158
159159 /// Length of this annotation as displayed in the stderr output
160- pub fn len ( & self ) -> usize {
160+ pub ( crate ) fn len ( & self ) -> usize {
161161 // Account for usize underflows
162162 if self . end_col . display > self . start_col . display {
163163 self . end_col . display - self . start_col . display
@@ -166,7 +166,7 @@ impl Annotation {
166166 }
167167 }
168168
169- pub fn has_label ( & self ) -> bool {
169+ pub ( crate ) fn has_label ( & self ) -> bool {
170170 if let Some ( ref label) = self . label {
171171 // Consider labels with no text as effectively not being there
172172 // to avoid weird output with unnecessary vertical lines, like:
@@ -184,7 +184,7 @@ impl Annotation {
184184 }
185185 }
186186
187- pub fn takes_space ( & self ) -> bool {
187+ pub ( crate ) fn takes_space ( & self ) -> bool {
188188 // Multiline annotations always have to keep vertical space.
189189 matches ! (
190190 self . annotation_type,
@@ -194,7 +194,7 @@ impl Annotation {
194194}
195195
196196#[ derive( Debug ) ]
197- pub struct StyledString {
197+ pub ( crate ) struct StyledString {
198198 pub text : String ,
199199 pub style : Style ,
200200}
0 commit comments