fix(scope): no new string allocation to count characters
This commit is contained in:
@@ -61,7 +61,11 @@ impl Scope {
|
|||||||
|
|
||||||
/// Returns the visible length of the header segment
|
/// Returns the visible length of the header segment
|
||||||
pub fn header_segment_len(&self) -> usize {
|
pub fn header_segment_len(&self) -> usize {
|
||||||
self.header_segment().chars().count()
|
if self.is_empty() {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
self.0.chars().count() + 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user