pub trait Anchor:
Sealed
+ Debug
+ Default
+ Clone
+ Copy {
// Required methods
fn assert<'a, H: Haystack<'a>>(hay: &H) -> ControlFlow<(), bool>;
fn assert_fixed<'a, H: Haystack<'a>>(hay: &H) -> bool;
}Required Methods§
Sourcefn assert<'a, H: Haystack<'a>>(hay: &H) -> ControlFlow<(), bool>
fn assert<'a, H: Haystack<'a>>(hay: &H) -> ControlFlow<(), bool>
Asserts that each anchor in this set could possibly succeed with the given haystack state. In the presence of a start anchor, the haystack’s position at the start doesn’t need to be checked again.
The return value represents two things:
-
The outer
ControlFlowrepresents whether the haystack has reached a point of no-return. If the value isControlFlow::Break, no more matches will succeed; no further attempts should be made to match against the haystack. For functions that return an option, it should be possible to try the return value with.continue_value()?. -
If the value of the outer type is
ControlFlow::Continue, the innerboolrepresents whether the current position should be checked for a match. A value offalseindicates that the haystack should be progressed before checking again.
Sourcefn assert_fixed<'a, H: Haystack<'a>>(hay: &H) -> bool
fn assert_fixed<'a, H: Haystack<'a>>(hay: &H) -> bool
Asserts that each anchor in this set could possibly succeed with the given haystack state. In the presence of a start anchor, the haystack’s position at the start doesn’t need to be checked again. This variant provide no information about whether the search should continue and should be called by searches that intend to match the entirety of the provided haystack.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.