rtb-assets 0.6.5

Embedded-asset + overlay filesystem abstraction. Part of the phpboyscout Rust toolkit.
Documentation
# rtb-assets

> Part of the [phpboyscout Rust toolkit]https://rust.phpboyscout.uk:
> small, framework-free crates extracted from
> [rust-tool-base]https://gitlab.com/phpboyscout/rust-tool-base.

Lets a Rust binary ship its own defaults and let users override them.
Compile-time embedded assets (`rust-embed`), physical directories and
in-memory fixtures sit behind one read-only API. Byte reads take the
file from the highest-priority layer that has it, YAML and JSON reads
deep-merge every layer (RFC 7396, so `null` deletes a key and arrays
replace), and `DirectorySource` rejects path traversal lexically.

```rust
use rtb_assets::Assets;
use std::collections::HashMap;

let assets = Assets::builder()
    .memory(
        "defaults",
        HashMap::from([("greeting.txt".into(), b"hello".to_vec())]),
    )
    .build();

assert_eq!(assets.open_text("greeting.txt").unwrap(), "hello");
```

- **Docs:** <https://assets.rust.phpboyscout.uk>
- **API reference:** <https://docs.rs/rtb-assets>
- **Crate:** <https://crates.io/crates/rtb-assets>

## Documentation

| | |
|---|---|
| [Ship defaults a user can override]https://assets.rust.phpboyscout.uk/tutorials/ship-defaults-a-user-can-override/ | tutorial: from `cargo new` to a working overlay |
| [Merge layered configuration]https://assets.rust.phpboyscout.uk/how-to/merge-layered-configuration/ | how-to, including how to shape a schema that merges well |
| [Diagnose a failed asset lookup]https://assets.rust.phpboyscout.uk/how-to/diagnose-a-failed-asset-lookup/ | how-to: why a read returned nothing |
| [Write a custom asset source]https://assets.rust.phpboyscout.uk/how-to/write-a-custom-asset-source/ | how-to: a layer the built-ins do not cover |
| [Use assets in tests]https://assets.rust.phpboyscout.uk/how-to/use-assets-in-tests/ | how-to: in-memory fixtures in place of files |
| [Merge semantics]https://assets.rust.phpboyscout.uk/reference/merge-semantics/ | reference: what merges, what replaces, what deletes |
| [What rtb-assets does not do]https://assets.rust.phpboyscout.uk/explanation/limitations/ | explanation: the deliberate absences, read before adopting |

## Development

`just ci` runs the full local gate (fmt, clippy, nextest, doc, deny).
Tests include a cucumber BDD suite (`tests/bdd.rs`). Releases are cut by
colophon from Conventional Commits; do not tag manually.

## License

MIT