@@ -5,13 +5,13 @@ use rustc_macros::{Decodable, Encodable};
5
5
use crate :: { Level , Loc } ;
6
6
7
7
#[ derive( Clone , Debug , PartialOrd , Ord , PartialEq , Eq ) ]
8
- pub struct Line {
8
+ pub ( crate ) struct Line {
9
9
pub line_index : usize ,
10
10
pub annotations : Vec < Annotation > ,
11
11
}
12
12
13
13
#[ derive( Clone , Copy , Debug , PartialOrd , Ord , PartialEq , Eq , Default ) ]
14
- pub struct AnnotationColumn {
14
+ pub ( crate ) struct AnnotationColumn {
15
15
/// the (0-indexed) column for *display* purposes, counted in characters, not utf-8 bytes
16
16
pub display : usize ,
17
17
/// the (0-indexed) column in the file, counted in characters, not utf-8 bytes.
@@ -31,13 +31,13 @@ pub struct AnnotationColumn {
31
31
}
32
32
33
33
impl AnnotationColumn {
34
- pub fn from_loc ( loc : & Loc ) -> AnnotationColumn {
34
+ pub ( crate ) fn from_loc ( loc : & Loc ) -> AnnotationColumn {
35
35
AnnotationColumn { display : loc. col_display , file : loc. col . 0 }
36
36
}
37
37
}
38
38
39
39
#[ derive( Clone , Debug , PartialOrd , Ord , PartialEq , Eq ) ]
40
- pub struct MultilineAnnotation {
40
+ pub ( crate ) struct MultilineAnnotation {
41
41
pub depth : usize ,
42
42
pub line_start : usize ,
43
43
pub line_end : usize ,
@@ -49,19 +49,19 @@ pub struct MultilineAnnotation {
49
49
}
50
50
51
51
impl MultilineAnnotation {
52
- pub fn increase_depth ( & mut self ) {
52
+ pub ( crate ) fn increase_depth ( & mut self ) {
53
53
self . depth += 1 ;
54
54
}
55
55
56
56
/// 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 {
58
58
self . line_start == other. line_start
59
59
&& self . line_end == other. line_end
60
60
&& self . start_col == other. start_col
61
61
&& self . end_col == other. end_col
62
62
}
63
63
64
- pub fn as_start ( & self ) -> Annotation {
64
+ pub ( crate ) fn as_start ( & self ) -> Annotation {
65
65
Annotation {
66
66
start_col : self . start_col ,
67
67
end_col : AnnotationColumn {
@@ -76,7 +76,7 @@ impl MultilineAnnotation {
76
76
}
77
77
}
78
78
79
- pub fn as_end ( & self ) -> Annotation {
79
+ pub ( crate ) fn as_end ( & self ) -> Annotation {
80
80
Annotation {
81
81
start_col : AnnotationColumn {
82
82
// these might not correspond to the same place anymore,
@@ -91,7 +91,7 @@ impl MultilineAnnotation {
91
91
}
92
92
}
93
93
94
- pub fn as_line ( & self ) -> Annotation {
94
+ pub ( crate ) fn as_line ( & self ) -> Annotation {
95
95
Annotation {
96
96
start_col : Default :: default ( ) ,
97
97
end_col : Default :: default ( ) ,
@@ -103,7 +103,7 @@ impl MultilineAnnotation {
103
103
}
104
104
105
105
#[ derive( Clone , Debug , PartialOrd , Ord , PartialEq , Eq ) ]
106
- pub enum AnnotationType {
106
+ pub ( crate ) enum AnnotationType {
107
107
/// Annotation under a single line of code
108
108
Singleline ,
109
109
@@ -129,7 +129,7 @@ pub enum AnnotationType {
129
129
}
130
130
131
131
#[ derive( Clone , Debug , PartialOrd , Ord , PartialEq , Eq ) ]
132
- pub struct Annotation {
132
+ pub ( crate ) struct Annotation {
133
133
/// Start column.
134
134
/// Note that it is important that this field goes
135
135
/// first, so that when we sort, we sort orderings by start
@@ -152,12 +152,12 @@ pub struct Annotation {
152
152
153
153
impl Annotation {
154
154
/// Whether this annotation is a vertical line placeholder.
155
- pub fn is_line ( & self ) -> bool {
155
+ pub ( crate ) fn is_line ( & self ) -> bool {
156
156
matches ! ( self . annotation_type, AnnotationType :: MultilineLine ( _) )
157
157
}
158
158
159
159
/// Length of this annotation as displayed in the stderr output
160
- pub fn len ( & self ) -> usize {
160
+ pub ( crate ) fn len ( & self ) -> usize {
161
161
// Account for usize underflows
162
162
if self . end_col . display > self . start_col . display {
163
163
self . end_col . display - self . start_col . display
@@ -166,7 +166,7 @@ impl Annotation {
166
166
}
167
167
}
168
168
169
- pub fn has_label ( & self ) -> bool {
169
+ pub ( crate ) fn has_label ( & self ) -> bool {
170
170
if let Some ( ref label) = self . label {
171
171
// Consider labels with no text as effectively not being there
172
172
// to avoid weird output with unnecessary vertical lines, like:
@@ -184,7 +184,7 @@ impl Annotation {
184
184
}
185
185
}
186
186
187
- pub fn takes_space ( & self ) -> bool {
187
+ pub ( crate ) fn takes_space ( & self ) -> bool {
188
188
// Multiline annotations always have to keep vertical space.
189
189
matches ! (
190
190
self . annotation_type,
@@ -194,7 +194,7 @@ impl Annotation {
194
194
}
195
195
196
196
#[ derive( Debug ) ]
197
- pub struct StyledString {
197
+ pub ( crate ) struct StyledString {
198
198
pub text : String ,
199
199
pub style : Style ,
200
200
}
0 commit comments