AccessibilityRule

Struct AccessibilityRule 

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

Rule for detecting accessibility issues in subtitle scripts

Analyzes scripts for patterns that may negatively impact accessibility, including reading speed, contrast, and timing issues that could make subtitles difficult to follow for users with various needs.

§Accessibility Checks

  • Display duration: Ensures events are displayed long enough to be readable
  • Reading speed: Warns about text that appears/disappears too quickly
  • Flash prevention: Detects rapid style changes that could trigger seizures

§Performance

  • Time complexity: O(n) for n events
  • Memory: O(1) additional space
  • Target: <1ms for typical scripts with 1000 events

§Example

use ass_core::analysis::linting::rules::accessibility::AccessibilityRule;
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,,Text without proper contrast
"#)?;

let analysis = ScriptAnalysis::analyze(&script)?;
let rule = AccessibilityRule;
let issues = rule.check_script(&analysis);

Trait Implementations§

Source§

impl LintRule for AccessibilityRule

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.