pub struct PromptDetector;Expand description
Stateless conservative detector for common visible shell prompt suffixes.
§Examples
use ailloli_ui_terminal_core::PromptDetector;
assert!(PromptDetector::detect_text("~/repo$ "));Implementations§
Source§impl PromptDetector
impl PromptDetector
Sourcepub fn detect_text(text: &str) -> bool
pub fn detect_text(text: &str) -> bool
Heuristically recognizes prompts ending in $, #, >, or ❯.
Trailing whitespace is ignored. ❯ and a marker with an empty prefix
are accepted. Other markers require a preceding whitespace/punctuation,
or a prefix containing @// or starting with ~. Matching is purely
textual and can produce false positives/negatives.
§Examples
use ailloli_ui_terminal_core::PromptDetector;
assert!(PromptDetector::detect_text("dev@host:~/repo$ "));
assert!(!PromptDetector::detect_text("price$99"));Auto Trait Implementations§
impl Freeze for PromptDetector
impl RefUnwindSafe for PromptDetector
impl Send for PromptDetector
impl Sync for PromptDetector
impl Unpin for PromptDetector
impl UnwindSafe for PromptDetector
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