faster text len
This commit is contained in:
parent
5ba645c009
commit
f590635f57
2 changed files with 2 additions and 2 deletions
|
@ -10,7 +10,7 @@ text_unit = "0.1.4"
|
||||||
itertools = "0.7.8"
|
itertools = "0.7.8"
|
||||||
drop_bomb = "0.1.4"
|
drop_bomb = "0.1.4"
|
||||||
parking_lot = "0.6.0"
|
parking_lot = "0.6.0"
|
||||||
smol_str = "0.1.4"
|
smol_str = "0.1.6"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
test_utils = { path = "../test_utils" }
|
test_utils = { path = "../test_utils" }
|
||||||
|
|
|
@ -31,7 +31,7 @@ impl GreenNode {
|
||||||
|
|
||||||
pub fn text_len(&self) -> TextUnit {
|
pub fn text_len(&self) -> TextUnit {
|
||||||
match self {
|
match self {
|
||||||
GreenNode::Leaf { text, .. } => TextUnit::of_str(text.as_str()),
|
GreenNode::Leaf { text, .. } => TextUnit::from(text.len() as u32),
|
||||||
GreenNode::Branch(b) => b.text_len(),
|
GreenNode::Branch(b) => b.text_len(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue