File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1429,6 +1429,15 @@ impl Regex {
1429
1429
pub fn locations ( & self ) -> CaptureLocations {
1430
1430
self . capture_locations ( )
1431
1431
}
1432
+
1433
+ /// Returns the memory usage, in bytes, of this `Regex`.
1434
+ ///
1435
+ /// This does **not** include the stack size used up by this `Regex`.
1436
+ /// To compute that, use `std::mem::size_of::<Regex>()`.
1437
+ #[ inline]
1438
+ pub fn memory_usage ( & self ) -> usize {
1439
+ self . meta . memory_usage ( )
1440
+ }
1432
1441
}
1433
1442
1434
1443
/// Represents a single match of a regex in a haystack.
Original file line number Diff line number Diff line change @@ -1432,6 +1432,15 @@ impl Regex {
1432
1432
pub fn locations ( & self ) -> CaptureLocations {
1433
1433
self . capture_locations ( )
1434
1434
}
1435
+
1436
+ /// Returns the memory usage, in bytes, of this `Regex`.
1437
+ ///
1438
+ /// This does **not** include the stack size used up by this `Regex`.
1439
+ /// To compute that, use `std::mem::size_of::<Regex>()`.
1440
+ #[ inline]
1441
+ pub fn memory_usage ( & self ) -> usize {
1442
+ self . meta . memory_usage ( )
1443
+ }
1435
1444
}
1436
1445
1437
1446
/// Represents a single match of a regex in a haystack.
You can’t perform that action at this time.
0 commit comments