Skip to content

Commit c01bdb7

Browse files
committed
doc tweaks
Adds documentation to README and library root regarding the fault-tolerant parsing feature. This explains how unexpected child boxes are handled during decoding and clarifies that they are not written back during encoding.
1 parent 2654b8e commit c01bdb7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ Using this library does require some additional knowledge of the format otherwis
1717

1818
See the [documentation](https://docs.rs/mp4-atom).
1919

20+
## Fault-Tolerant Parsing
21+
This library implements fault-tolerant parsing for container boxes. When decoding a container box (such as `moov`, `trak`, `mdia`, etc.), if an unexpected or unknown child box is encountered, instead of failing the entire parsing operation, the unknown box is collected in an `unexpected` field as an `Any` atom.
22+
23+
All container box structures include an `unexpected: Vec<Any>` field that collects these unrecognized boxes.
24+
25+
Note that when encoding, the `unexpected` boxes are **not** written back - only the explicitly defined fields are encoded.
26+
2027
## Examples
2128
### Decoding/encoding a byte buffer
2229
```rust

src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
//! The simplest way to decode with this library is with [Any::decode], returning any supported atom in a giant enum.
1717
//! For encoding you will call encode on the atom directly, ex: [Moov::encode].
1818
//!
19+
//! ## Fault-Tolerant Parsing
20+
//! This library implements fault-tolerant parsing for container boxes. When decoding a container box (such as `moov`, `trak`, `mdia`, etc.), if an unexpected or unknown child box is encountered, instead of failing the entire parsing operation, the unknown box is collected in an `unexpected` field as an `Any` atom.
21+
//!
22+
//! All container box structures include an `unexpected: Vec<Any>` field that collects these unrecognized boxes.
23+
//!
24+
//! Note that when encoding, the `unexpected` boxes are **not** written back - only the explicitly defined fields are encoded.
25+
//!
1926
//! ## Traits
2027
//! This library gates functionality behind quite a few traits:
2128
//!

0 commit comments

Comments
 (0)