Implement Regex::source_and_options_equals#1351
Conversation
BurntSushi
left a comment
There was a problem hiding this comment.
I think this is on the right track. We'll want to add this to the other regex APIs (bytes, set and bytes set). And also regex-lite.
| /// assert!(!r1.source_and_options_equals(&r3)); | ||
| /// ``` | ||
| #[inline] | ||
| pub fn source_and_options_equals(&self, other: &Self) -> bool { |
There was a problem hiding this comment.
This naming will need work. I don't like how it is right now. But I don't have the spoons to come up with a better one at the moment.
There was a problem hiding this comment.
I think you're right that the name could be improved, but I'm not quite sure how. The _equals part I believe should stay. source_and_options could perhaps be replaced by compile_inputs or regex_info, but I'm not sure whether that is better. Replacing source by str or pattern could also make sense.
There was a problem hiding this comment.
@BurntSushi Hello, did you happen to have any ideas about a better name?
Regex::source_and_options_equalsprovides API for testing regex equivalence while permitting false negatives (closes #1349)