pub struct MissingStyleRule;Available on crate feature
analysis only.Expand description
Rule for detecting events that reference undefined styles
Events must reference valid style names defined in the [V4+ Styles] section. Missing style references cause renderers to fall back to default styling, which may not match the intended visual appearance.
§Performance
- Time complexity: O(n + m) for n styles and m events
- Memory: O(n) for style name collection
- Target: <1ms for typical scripts with 100 styles and 1000 events
§Example
use ass_core::analysis::linting::rules::missing_style::MissingStyleRule;
use ass_core::analysis::linting::LintRule;
use ass_core::{Script, ScriptAnalysis};
let script = Script::parse(r#"
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Arial,20,&H00FFFFFF&,&H000000FF&,&H00000000&,&H00000000&,0,0,0,0,100,100,0,0,1,2,0,2,10,10,10,1
[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.00,0:00:05.00,Undefined,,0,0,0,,Text with undefined style
"#)?;
let analysis = ScriptAnalysis::analyze(&script)?;
let rule = MissingStyleRule;
let issues = rule.check_script(&analysis);
assert!(!issues.is_empty()); // Should detect the missing style referenceTrait Implementations§
Source§impl LintRule for MissingStyleRule
impl LintRule for MissingStyleRule
Source§fn description(&self) -> &'static str
fn description(&self) -> &'static str
Rule description.
Source§fn default_severity(&self) -> IssueSeverity
fn default_severity(&self) -> IssueSeverity
Default severity level.
Source§fn category(&self) -> IssueCategory
fn category(&self) -> IssueCategory
Issue category this rule checks for.
Source§fn check_script(&self, analysis: &ScriptAnalysis<'_>) -> Vec<LintIssue>
fn check_script(&self, analysis: &ScriptAnalysis<'_>) -> Vec<LintIssue>
Check script and return issues.
Auto Trait Implementations§
impl Freeze for MissingStyleRule
impl RefUnwindSafe for MissingStyleRule
impl Send for MissingStyleRule
impl Sync for MissingStyleRule
impl Unpin for MissingStyleRule
impl UnwindSafe for MissingStyleRule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more