Skip to main content

luaur_analysis/records/
to_string_result.rs

1use crate::records::to_string_span::ToStringSpan;
2use alloc::string::String;
3use alloc::vec::Vec;
4
5#[derive(Debug, Clone)]
6pub struct ToStringResult {
7    pub name: String,
8    /// Records which TypeId produced each substring of the output. Only recorded for named types
9    pub type_spans: Vec<ToStringSpan>,
10    pub invalid: bool,
11    pub error: bool,
12    pub cycle: bool,
13    pub truncated: bool,
14}
15
16impl Default for ToStringResult {
17    fn default() -> Self {
18        Self {
19            name: String::new(),
20            type_spans: Vec::new(),
21            invalid: false,
22            error: false,
23            cycle: false,
24            truncated: false,
25        }
26    }
27}
28
29#[allow(non_snake_case)]
30impl ToStringResult {
31    pub fn name(&self) -> &str {
32        &self.name
33    }
34
35    pub fn typeSpans(&self) -> &[ToStringSpan] {
36        &self.type_spans
37    }
38
39    pub fn invalid(&self) -> bool {
40        self.invalid
41    }
42
43    pub fn error(&self) -> bool {
44        self.error
45    }
46
47    pub fn cycle(&self) -> bool {
48        self.cycle
49    }
50
51    pub fn truncated(&self) -> bool {
52        self.truncated
53    }
54}