| Crates.io | ass-core |
| lib.rs | ass-core |
| version | 0.1.1 |
| created_at | 2025-08-06 08:16:04.235397+00 |
| updated_at | 2025-08-06 08:40:11.18728+00 |
| description | High-performance ASS subtitle format parser and analyzer |
| homepage | https://github.com/wiedymi/ass-rs |
| repository | https://github.com/wiedymi/ass-rs |
| max_upload_size | |
| id | 1783547 |
| size | 1,687,659 |
High-performance ASS (Advanced SubStation Alpha) subtitle format parser and analyzer for Rust.
Add to your Cargo.toml:
[dependencies]
ass-core = { version = "0.1", features = ["analysis"] }
Basic usage:
use ass_core::parser::Script;
let script_text = r#"
[Script Info]
Title: Example
ScriptType: v4.00+
[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,,Hello World!
"#;
let script = Script::parse(script_text)?;
println!("Parsed {} sections", script.sections().len());
use ass_core::analysis::ScriptAnalysis;
let analysis = ScriptAnalysis::analyze(&script)?;
println!("Found {} dialogue events", analysis.dialogue_info().len());
use ass_core::analysis::linting::{lint_script, LintConfig};
let config = LintConfig::default();
let issues = lint_script(&script, &config)?;
for issue in issues {
println!("{}: {}", issue.severity(), issue.message());
}
use ass_core::parser::streaming::StreamingParser;
let mut parser = StreamingParser::new();
for chunk in file_chunks {
parser.feed_chunk(chunk)?;
}
let result = parser.finalize()?;
std (default): Standard library supportnostd: nostd compatibilityanalysis: Enable script analysis and lintingplugins: Extension registry supportsimd: SIMD-accelerated parsingarena: Arena allocation for improved performancestream: Streaming/chunked input supportserde: Serialization supportbenches: Enable benchmarking infrastructureThe crate is organized into several modules:
parser: Core ASS parsing with zero-copy ASTanalysis: Deep script analysis and optimization detectionlinting: Comprehensive rule-based script validationutils: Common utilities and error typesPerformance benchmarks can be run with:
# Run all benchmarks
cargo bench --features=benches
# Run specific benchmarks
cargo bench --features=benches parser_benchmarks
cargo bench --features=benches incremental_benchmarks
The benchmarking suite includes:
To analyze memory usage without external tools:
# Run memory benchmarks
cargo bench --features=benches memory_benchmarks
# Run simple memory profiler
cargo run --features=benches --bin memory-profile
The memory profiler shows:
For faster benchmark runs (e.g., in CI):
# Quick mode - fewer samples, shorter measurement time
QUICK_BENCH=1 cargo bench --features=benches
# Run specific benchmark group
cargo bench --features=benches incremental_parsing
# Increase time limit for complex benchmarks
cargo bench --features=benches -- --measurement-time 15
If you see warnings about unable to complete samples:
QUICK_BENCH=1 for faster iterationLicensed under the MIT license.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.