tastty-core 0.1.0

Sans-IO core of the tastty terminal session library: VT parser, screen buffer, and byte encoders.
//! Error types for parser, screen, and encoder operations.

/// Errors produced by the core parser, screen, and encoder APIs.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
    /// Returned when a [`TerminalSize`](crate::TerminalSize) is constructed
    /// with a zero row or column count. Zero-sized terminals are malformed:
    /// every downstream grid, cursor, and clamp routine assumes at least one
    /// row and one column.
    #[error("terminal dimensions must be non-zero (got rows={rows}, cols={cols})")]
    InvalidDimensions {
        /// Requested row count.
        rows: u16,
        /// Requested column count.
        cols: u16,
    },
}

/// Convenience alias for results produced by the core.
pub type Result<T> = std::result::Result<T, Error>;