@@ -9,8 +9,8 @@ use nohash_hasher::IntMap;
9
9
10
10
pub use text_size:: { TextRange , TextSize } ;
11
11
12
- /// Line/Column information in native, utf8 format .
13
- #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash ) ]
12
+ /// `(line, column)` information in the native, UTF-8 encoding .
13
+ #[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
14
14
pub struct LineCol {
15
15
/// Zero-based.
16
16
pub line : u32 ,
@@ -19,7 +19,7 @@ pub struct LineCol {
19
19
}
20
20
21
21
/// A kind of wide character encoding.
22
- #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash ) ]
22
+ #[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
23
23
#[ non_exhaustive]
24
24
pub enum WideEncoding {
25
25
/// UTF-16.
@@ -29,7 +29,7 @@ pub enum WideEncoding {
29
29
}
30
30
31
31
impl WideEncoding {
32
- /// Returns the number of units it takes to encode `text` in this encoding.
32
+ /// Returns the number of code units it takes to encode `text` in this encoding.
33
33
pub fn measure ( & self , text : & str ) -> usize {
34
34
match self {
35
35
WideEncoding :: Utf16 => text. encode_utf16 ( ) . count ( ) ,
@@ -38,22 +38,24 @@ impl WideEncoding {
38
38
}
39
39
}
40
40
41
- /// Line/Column information in legacy encodings.
41
+ /// `(line, column)` information in wide encodings.
42
+ ///
43
+ /// See [`WideEncoding`] for the kinds of wide encodings available.
42
44
//
43
45
// Deliberately not a generic type and different from `LineCol`.
44
- #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash ) ]
46
+ #[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
45
47
pub struct WideLineCol {
46
48
/// Zero-based.
47
49
pub line : u32 ,
48
50
/// Zero-based.
49
51
pub col : u32 ,
50
52
}
51
53
52
- #[ derive( Clone , Debug , Hash , PartialEq , Eq ) ]
54
+ #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
53
55
struct WideChar {
54
- /// Start offset of a character inside a line, zero-based
56
+ /// Start offset of a character inside a line, zero-based.
55
57
start : TextSize ,
56
- /// End offset of a character inside a line, zero-based
58
+ /// End offset of a character inside a line, zero-based.
57
59
end : TextSize ,
58
60
}
59
61
0 commit comments