pub struct ReadinessDetector { /* private fields */ }Expand description
Stateless readiness evaluator — called repeatedly in a polling loop.
Implementations§
Source§impl ReadinessDetector
impl ReadinessDetector
Sourcepub fn new(
strategy: ReadinessStrategy,
patterns_str: &[String],
silence_timeout_ms: u64,
max_timeout_ms: u64,
) -> Self
pub fn new( strategy: ReadinessStrategy, patterns_str: &[String], silence_timeout_ms: u64, max_timeout_ms: u64, ) -> Self
Build a detector from raw parts.
Invalid regex patterns are silently skipped (with a tracing::warn).
If no patterns compile, the strategy is downgraded to Timeout.
Sourcepub fn from_config(config: &ShellConfig) -> Self
pub fn from_config(config: &ShellConfig) -> Self
Build from the default ShellConfig.
Sourcepub fn check(
&self,
output: &str,
silence_elapsed: Duration,
total_elapsed: Duration,
) -> ReadinessResult
pub fn check( &self, output: &str, silence_elapsed: Duration, total_elapsed: Duration, ) -> ReadinessResult
Evaluate the current output snapshot against the active strategy.
Called in a tight poll loop — the caller tracks silence_elapsed
(time since last new output byte) and total_elapsed (wall-clock since
the command was sent).
Sourcepub fn matches_prompt(&self, output: &str) -> bool
pub fn matches_prompt(&self, output: &str) -> bool
Check the tail of output for a known prompt pattern.
Only inspects the last ~200 chars (prompts live at the end), and strips ANSI escapes before matching. The match runs against the last non-empty line.
Auto Trait Implementations§
impl Freeze for ReadinessDetector
impl RefUnwindSafe for ReadinessDetector
impl Send for ReadinessDetector
impl Sync for ReadinessDetector
impl Unpin for ReadinessDetector
impl UnsafeUnpin for ReadinessDetector
impl UnwindSafe for ReadinessDetector
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.