fasrt 0.1.0

A blazing fast, zero-copy subtitle parser and writer for SRT and WebVTT in Rust.
docs.rs failed to build fasrt-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

A blazing fast, zero-copy subtitle parser and writer for SRT and WebVTT in Rust.

Installation

[dependencies]
fasrt = "0.1"

Features

  • Zero-copy, zero-allocation parsing — borrows directly from the input string
  • #![no_std] support (with optional alloc and std features)
  • Lazy iterator-based parsing — blocks are yielded on demand
  • DFA-based lexing via logos for fast tokenization
  • Strongly-typed newtypes (Hour, Minute, Second, Millisecond, Percentage) with compile-time validation
  • W3C WebVTT spec conformant — validated against Web Platform Tests

SRT

  • Strict and lossy parsing modes
  • Timestamps (HH:MM:SS,mmm)
  • Multiline cue bodies
  • Writer (std feature)

WebVTT

  • WEBVTT signature and header text
  • Timestamps (short MM:SS.mmm and long HH:MM:SS.mmm forms, unbounded hours)
  • Cue identifiers (zero-copy &str)
  • Cue settings (vertical, line, position, size, align, region)
  • NOTE, STYLE, REGION blocks
  • Full REGION definition parsing (id, width, lines, regionanchor, viewportanchor, scroll)
  • Float percentages (e.g., 50.5%)
  • CRLF, CR, LF line endings
  • BOM handling
  • Error recovery (--> in cue body, malformed timing lines)
  • Writer with round-trip fidelity (std feature)
  • Cue text parsing — two-layer design:
    • CueParser: logos DFA-backed, zero-alloc token stream (no_std)
    • CueText: W3C spec-compliant DOM tree builder with Node/TagNode types (alloc/std)
    • Tags: <b>, <i>, <u>, <c>, <ruby>, <rt>, <v>, <lang>, with classes and annotations
    • W3C tree building algorithm: implied end tags, <rt> scoping, unterminated tag handling
    • Full HTML5 named character reference support (2,231 entities via phf perfect hash map)
    • Numeric (&#32;) and hexadecimal (&#x20;) character references
    • Lazy text normalization via CueStr with OnceCell-cached decoding and NULL (U+0000 → U+FFFD) replacement

Optional dependencies

Feature Default Description
std Yes Enables std::io writer and thiserror::Error impls
alloc No Enables CueText DOM tree and entity decoding without std
memchr Yes (via alloc/std) SIMD-accelerated fast path for entity decoding

License

fasrt is under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE, LICENSE-MIT for details.

Copyright (c) 2026 FinDIT Studio authors.