Skip to main content

ass_core/parser/streaming/
result.rs

1//! Owned result type produced when a streaming parse completes
2//!
3//! Defines [`StreamingResult`], the final output of [`super::StreamingParser`]
4//! containing the parsed sections, detected script version, and any issues
5//! encountered while streaming.
6
7use crate::ScriptVersion;
8use alloc::{string::String, vec::Vec};
9
10/// Result of streaming parser containing owned sections
11#[derive(Debug, Clone)]
12pub struct StreamingResult {
13    /// Parsed sections in document order (simplified)
14    pub sections: Vec<String>,
15    /// Script version detected from headers
16    pub version: ScriptVersion,
17    /// Parse warnings and recoverable errors
18    pub issues: Vec<crate::parser::ParseIssue>,
19}
20
21impl StreamingResult {
22    /// Get parsed sections (simplified)
23    #[must_use]
24    pub fn sections(&self) -> &[String] {
25        &self.sections
26    }
27
28    /// Get detected script version
29    #[must_use]
30    pub const fn version(&self) -> ScriptVersion {
31        self.version
32    }
33
34    /// Get parsing issues
35    #[must_use]
36    pub fn issues(&self) -> &[crate::parser::ParseIssue] {
37        &self.issues
38    }
39}