aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/rope.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/rope.rs b/src/rope.rs
index e74dd4c..b5b5f36 100644
--- a/src/rope.rs
+++ b/src/rope.rs
@@ -49,6 +49,10 @@ impl Rope {
}
}
+ pub fn is_empty(&self) -> bool {
+ self.len() == 0
+ }
+
pub fn lines(&self) -> usize {
match self {
Rope(Node::Leaf(l)) => usize::from(l.lines),
@@ -194,10 +198,10 @@ impl Rope {
}
pub fn concat(&self, other: &Rope) -> Rope {
- if self.len() == 0 {
+ if self.is_empty() {
return other.clone();
}
- if other.len() == 0 {
+ if other.is_empty() {
return self.clone();
}
match self.concat_height(self.height(), other, other.height()) {