Skip to content

Commit 0bb2153

Browse files
committed
Tweak comments, swap
1 parent 594a41e commit 0bb2153

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

lib/line-index/src/lib.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use nohash_hasher::IntMap;
99

1010
pub use text_size::{TextRange, TextSize};
1111

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)]
1414
pub struct LineCol {
1515
/// Zero-based.
1616
pub line: u32,
@@ -19,7 +19,7 @@ pub struct LineCol {
1919
}
2020

2121
/// A kind of wide character encoding.
22-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
22+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2323
#[non_exhaustive]
2424
pub enum WideEncoding {
2525
/// UTF-16.
@@ -29,7 +29,7 @@ pub enum WideEncoding {
2929
}
3030

3131
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.
3333
pub fn measure(&self, text: &str) -> usize {
3434
match self {
3535
WideEncoding::Utf16 => text.encode_utf16().count(),
@@ -38,22 +38,24 @@ impl WideEncoding {
3838
}
3939
}
4040

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.
4244
//
4345
// 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)]
4547
pub struct WideLineCol {
4648
/// Zero-based.
4749
pub line: u32,
4850
/// Zero-based.
4951
pub col: u32,
5052
}
5153

52-
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
54+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5355
struct WideChar {
54-
/// Start offset of a character inside a line, zero-based
56+
/// Start offset of a character inside a line, zero-based.
5557
start: TextSize,
56-
/// End offset of a character inside a line, zero-based
58+
/// End offset of a character inside a line, zero-based.
5759
end: TextSize,
5860
}
5961

0 commit comments

Comments
 (0)