File tree 2 files changed +24
-0
lines changed
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,18 @@ impl<'t> Match<'t> {
37
37
self . end
38
38
}
39
39
40
+ /// Returns true if and only if this match has a length of zero.
41
+ #[ inline]
42
+ pub fn is_empty ( & self ) -> bool {
43
+ self . start == self . end
44
+ }
45
+
46
+ /// Returns the length, in bytes, of this match.
47
+ #[ inline]
48
+ pub fn len ( & self ) -> usize {
49
+ self . end - self . start
50
+ }
51
+
40
52
/// Returns the range over the starting and ending byte offsets of the
41
53
/// match in the haystack.
42
54
#[ inline]
Original file line number Diff line number Diff line change @@ -45,6 +45,18 @@ impl<'t> Match<'t> {
45
45
self . end
46
46
}
47
47
48
+ /// Returns true if and only if this match has a length of zero.
49
+ #[ inline]
50
+ pub fn is_empty ( & self ) -> bool {
51
+ self . start == self . end
52
+ }
53
+
54
+ /// Returns the length, in bytes, of this match.
55
+ #[ inline]
56
+ pub fn len ( & self ) -> usize {
57
+ self . end - self . start
58
+ }
59
+
48
60
/// Returns the range over the starting and ending byte offsets of the
49
61
/// match in the haystack.
50
62
#[ inline]
You can’t perform that action at this time.
0 commit comments