A trait for pattern matching, similar to `PartialEq` but for flexible matching. The `Like` trait enables custom pattern matching logic beyond simple equality. It's primarily used with the `=~` operator in `assert_struct!` macro to support regex patterns, custom matching logic, and other pattern-based comparisons. # Examples ## Basic String Pattern Matching ``` # #[cfg(feature = "regex")] # { u
| 988 | /// assert!(email.like(&pattern)); |
| 989 | /// ``` |
| 990 | pub trait Like<Rhs = Self> { |
| 991 | /// Returns `true` if `self` matches the pattern `other`. |
| 992 | /// |
| 993 | /// # Examples |
| 994 | /// |
| 995 | /// ``` |
| 996 | /// # #[cfg(feature = "regex")] |
| 997 | /// # { |
| 998 | /// use assert_struct::Like; |
| 999 | /// |
| 1000 | /// let s = "test123"; |
| 1001 | /// assert!(s.like(&r"\w+\d+")); |
| 1002 | /// # } |
| 1003 | /// ``` |
| 1004 | fn like(&self, other: &Rhs) -> bool; |
| 1005 | } |
| 1006 | |
| 1007 | // String/&str implementations for regex pattern matching |
| 1008 | #[cfg(feature = "regex")] |
no outgoing calls
no test coverage detected