Struct TerminalOutputClassifier

Source
pub struct TerminalOutputClassifier;
Expand description

Stateless, case-sensitive heuristic terminal-output classifier.

§Examples

use ailloli_ui_terminal_core::TerminalOutputClassifier;
let classifier = TerminalOutputClassifier::new();
assert_eq!(classifier, TerminalOutputClassifier);

Implementations§

Source§

impl TerminalOutputClassifier

Source

pub fn new() -> Self

Creates the zero-sized stateless classifier.

§Examples
use ailloli_ui_terminal_core::TerminalOutputClassifier;
assert_eq!(TerminalOutputClassifier::new(), TerminalOutputClassifier::default());
Source

pub fn classify(&self, state: &TerminalState) -> TerminalOutputClassification

Classifies the normal screen, retained scrollback, and failed command history.

Patterns are case-sensitive and may emit several diagnostics for one line. Relative file locations use state.cwd_uri, falling back to the shell CWD; no filesystem access occurs. Results sort by global line then severity (Error, Warning, Info, Hint), deduplicate equal semantic keys, assign fresh IDs starting at one, and emit matching Added events. The alternate screen is not classified even when active. Complexity is linear in text plus command history except duplicate removal, which is quadratic in the number of candidate diagnostics.

§Examples
use ailloli_ui_terminal_core::{TerminalDiagnosticKind, TerminalOutputClassifier, TerminalState};
let mut state = TerminalState::new();
state.write_str("error: build failed");
let output = TerminalOutputClassifier::new().classify(&state);
assert!(output.diagnostics.iter().any(|item| item.kind == TerminalDiagnosticKind::RustcError));

Trait Implementations§

Source§

impl Clone for TerminalOutputClassifier

Source§

fn clone(&self) -> TerminalOutputClassifier

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TerminalOutputClassifier

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TerminalOutputClassifier

Source§

fn default() -> TerminalOutputClassifier

Returns the “default value” for a type. Read more
Source§

impl PartialEq for TerminalOutputClassifier

Source§

fn eq(&self, other: &TerminalOutputClassifier) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for TerminalOutputClassifier

Source§

impl Eq for TerminalOutputClassifier

Source§

impl StructuralPartialEq for TerminalOutputClassifier

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.