tgqe 0.0.2

The Great Qin Empire —— A centralized system for integrating and summarizing common compiler front-end library errors and span error output libraries, with optional Ariadne integration.
/**

 *  - Copyright (c) 星灿长风v(Starwindv) 2026/08/03
 *  - License: BSD-3
 *  - Author: 星灿长风v(StarWindv)
 *  - Location: tgqe/src/modules/impls/line_code.rs
 */
use crate::base_types::{
    TgqeLine, TgqeLinesIter,
};

impl TgqeLine {
    pub fn new(
        filepath: &str,
        line: i16,
        code: String,
    ) -> Self {
        Self {
            filepath: filepath.to_string(),
            line,
            code,
        }
    }
}

impl Default for TgqeLine {
    fn default() -> Self {
        Self::new(
            "[TGQE] Unknown",
            -1,
            "[TGQE] Unknown".to_string(),
        )
    }
}

impl TgqeLinesIter {
    pub(crate) fn new(
        lines: Vec<TgqeLine>,
    ) -> Self {
        Self {
            inner: lines.into_iter(),
        }
    }
}

impl Iterator for TgqeLinesIter {
    type Item = TgqeLine;

    fn next(
        &mut self,
    ) -> Option<Self::Item> {
        self.inner.next()
    }

    fn size_hint(
        &self,
    ) -> (usize, Option<usize>) {
        self.inner.size_hint()
    }
}

impl ExactSizeIterator for TgqeLinesIter {}