pub struct TriggerPattern { /* private fields */ }Expand description
A regular expression that switches a lazy grammar on.
llama_grammar_trigger_pattern. Holds two compiled forms because
upstream’s find uses two: std::regex_match (the whole buffer must
match) is tried first for a pattern written ^...$, and
std::regex_search (match anywhere) is the fallback for every pattern.
The two can disagree about which alternative matches, and therefore
about where the first capture group starts.
Implementations§
Source§impl TriggerPattern
impl TriggerPattern
Sourcepub fn new(pattern: &str) -> Result<Self, GrammarError>
pub fn new(pattern: &str) -> Result<Self, GrammarError>
Compile pattern.
Trait Implementations§
Source§impl Clone for TriggerPattern
impl Clone for TriggerPattern
Source§fn clone(&self) -> TriggerPattern
fn clone(&self) -> TriggerPattern
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TriggerPattern
impl Debug for TriggerPattern
impl Eq for TriggerPattern
Source§impl PartialEq for TriggerPattern
Two patterns are the same trigger when they are the same source. The
compiled forms are a function of it.
impl PartialEq for TriggerPattern
Two patterns are the same trigger when they are the same source. The compiled forms are a function of it.
Auto Trait Implementations§
impl Freeze for TriggerPattern
impl RefUnwindSafe for TriggerPattern
impl Send for TriggerPattern
impl Sync for TriggerPattern
impl Unpin for TriggerPattern
impl UnsafeUnpin for TriggerPattern
impl UnwindSafe for TriggerPattern
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more