TimingOverlapRule

Struct TimingOverlapRule 

Source
pub struct TimingOverlapRule;
Available on crate feature analysis only.
Expand description

Rule for detecting timing overlaps between dialogue events

Uses sweep-line algorithm for efficient O(n log n) overlap detection. Overlapping events can cause rendering conflicts where multiple subtitles appear simultaneously, potentially causing readability issues.

§Performance

  • Time complexity: O(n log n) via sweep-line algorithm
  • Memory: O(n) for temporary data structures
  • Target: <1ms for 1000 events on typical hardware

§Example

use ass_core::analysis::linting::rules::timing_overlap::TimingOverlapRule;
use ass_core::analysis::linting::LintRule;
use ass_core::{Script, ScriptAnalysis};

let script = Script::parse(r#"
[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.00,0:00:05.00,Default,,0,0,0,,First event
Dialogue: 0,0:00:03.00,0:00:08.00,Default,,0,0,0,,Overlapping event
"#)?;

let analysis = ScriptAnalysis::analyze(&script)?;
let rule = TimingOverlapRule;
let issues = rule.check_script(&analysis);
assert!(!issues.is_empty()); // Should detect the overlap

Trait Implementations§

Source§

impl LintRule for TimingOverlapRule

Source§

fn id(&self) -> &'static str

Unique identifier for this rule.
Source§

fn name(&self) -> &'static str

Human-readable name.
Source§

fn description(&self) -> &'static str

Rule description.
Source§

fn default_severity(&self) -> IssueSeverity

Default severity level.
Source§

fn category(&self) -> IssueCategory

Issue category this rule checks for.
Source§

fn check_script(&self, analysis: &ScriptAnalysis<'_>) -> Vec<LintIssue>

Check script and return issues.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.