1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
//! Rust port of [erengy/anitomy](https://github.com/erengy/anitomy), an
//! anime video filename parser.
//!
//! The public API (`ElementKind`, `Element`, `Options`, `parse`) matches
//! upstream; [`detail`] holds the implementation, one module per upstream
//! C++ header. See `anitomy/tests/conformance.rs` for the harness that
//! checks output against upstream's and anitopy's fixture suites.
//!
//! Pure, safe Rust: no `unsafe`, no C dependencies, so it cross-compiles
//! and builds wheels anywhere `rustc` runs.
//!
//! This crate parses untrusted, arbitrary filenames, so it must never panic
//! on any input; a panic here would be a denial-of-service bug. The lints
//! below turn the usual panic
//! sources (`.unwrap()`, `.expect()`, `panic!`, `unreachable!`, direct
//! `s[i]` indexing) into hard errors under `cargo clippy` (see
//! `tests/no_panic.rs` for a runtime check of the same property, which
//! catches what lints can't, e.g. integer overflow). Prefer `.get(i)`,
//! pattern matching, `?`, and `.unwrap_or(...)` instead.
pub use ;
pub use Options;
/// Port of the free function `anitomy::parse` in `include/anitomy.hpp`.
///
/// `input` must be UTF-8 encoded and should be in composed form (NFC/NFKC).
/// Returns parsed elements ordered by their position in `input`; there may
/// be multiple elements of the same kind.