From a99d1522e706bc71164712e8254e370cf8e36428 Mon Sep 17 00:00:00 2001 From: Michal Moskal Date: Fri, 4 Oct 2024 23:34:31 +0000 Subject: [PATCH] add StopReason::is_ok() --- parser/src/api.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/parser/src/api.rs b/parser/src/api.rs index 329d6a19..55da6f75 100644 --- a/parser/src/api.rs +++ b/parser/src/api.rs @@ -303,6 +303,16 @@ impl StopReason { .unwrap() .to_string() } + + pub fn is_ok(&self) -> bool { + matches!( + self, + StopReason::NotStopped + | StopReason::EndOfSentence + | StopReason::NoExtension + | StopReason::NoExtensionBias + ) + } } #[derive(Clone, Serialize, Deserialize, Debug)]