pub struct Pattern { /* private fields */ }Expand description
Pattern represents a successfully parsed Relay pattern.
A pattern can be parsed/de-serialized from a string, serializing a pattern again may not produce the same original pattern but a normalized variant of the pattern.
let pattern = Pattern::builder("Foo**").case_insensitive(true).build().unwrap();
assert_eq!(&pattern.to_string(), "foo*");Patterns can be compared with other patterns, a pattern is considered equal with another pattern if its parsed and normalized forms and options are the same. Two patterns with the same options but built from different strings may compare equal if their normalized forms are the same.
let pattern1 = Pattern::builder("Foo**").case_insensitive(true).build().unwrap();
let pattern2 = Pattern::builder("foo*").case_insensitive(true).build().unwrap();
assert_eq!(&pattern1, &pattern2);
let pattern1 = Pattern::builder("Foo**").case_insensitive(true).build().unwrap();
let pattern2 = Pattern::builder("foo*").case_insensitive(false).build().unwrap();
assert_ne!(&pattern1, &pattern2);Implementations§
Trait Implementations§
Source§impl<C> AsRef<Pattern> for TypedPattern<C>
impl<C> AsRef<Pattern> for TypedPattern<C>
Source§impl<'de> Deserialize<'de> for Pattern
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Pattern
Available on crate feature
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Pattern
Source§impl<C> From<TypedPattern<C>> for Pattern
impl<C> From<TypedPattern<C>> for Pattern
Source§fn from(value: TypedPattern<C>) -> Self
fn from(value: TypedPattern<C>) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for Pattern
Auto Trait Implementations§
impl Freeze for Pattern
impl RefUnwindSafe for Pattern
impl Send for Pattern
impl Sync for Pattern
impl Unpin for Pattern
impl UnsafeUnpin for Pattern
impl UnwindSafe for Pattern
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more