aboutsummaryrefslogtreecommitdiff
path: root/src/text.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/text.rs')
-rw-r--r--src/text.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/text.rs b/src/text.rs
index af0a4a9e7..ac1a54a75 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -64,7 +64,6 @@ impl ops::SubAssign<TextUnit> for TextUnit {
64 } 64 }
65} 65}
66 66
67
68#[derive(Clone, Copy, PartialEq, Eq)] 67#[derive(Clone, Copy, PartialEq, Eq)]
69pub struct TextRange { 68pub struct TextRange {
70 start: TextUnit, 69 start: TextUnit,
@@ -83,7 +82,6 @@ impl fmt::Display for TextRange {
83 } 82 }
84} 83}
85 84
86
87impl TextRange { 85impl TextRange {
88 pub fn empty() -> TextRange { 86 pub fn empty() -> TextRange {
89 TextRange::from_to(TextUnit::new(0), TextUnit::new(0)) 87 TextRange::from_to(TextUnit::new(0), TextUnit::new(0))
@@ -91,7 +89,10 @@ impl TextRange {
91 89
92 pub fn from_to(from: TextUnit, to: TextUnit) -> TextRange { 90 pub fn from_to(from: TextUnit, to: TextUnit) -> TextRange {
93 assert!(from <= to, "Invalid text range [{}; {})", from, to); 91 assert!(from <= to, "Invalid text range [{}; {})", from, to);
94 TextRange { start: from, end: to } 92 TextRange {
93 start: from,
94 end: to,
95 }
95 } 96 }
96 97
97 pub fn from_len(from: TextUnit, len: TextUnit) -> TextRange { 98 pub fn from_len(from: TextUnit, len: TextUnit) -> TextRange {
@@ -121,4 +122,4 @@ impl ops::Index<TextRange> for str {
121 fn index(&self, index: TextRange) -> &str { 122 fn index(&self, index: TextRange) -> &str {
122 &self[index.start().0 as usize..index.end().0 as usize] 123 &self[index.start().0 as usize..index.end().0 as usize]
123 } 124 }
124} \ No newline at end of file 125}