#object #lets #treat #data #directory-embedding #rust-embed-wrapper #ownerable

directorate

A object wrapper of rust_embed that lets you treat your embeded data as a ownerable object type

4 releases

0.0.4 Nov 2, 2024
0.0.3 Nov 2, 2024
0.0.2 Nov 2, 2024
0.0.1 Nov 2, 2024

#1 in #lets

Download history 274/week @ 2024-10-30 43/week @ 2024-11-06 1/week @ 2024-11-13

318 downloads per month

Apache-2.0

7KB
104 lines

Directorate

Build Status crates.io docs.rs

Provides a small but usable wrapper for the rust_embed crate, sometimes you want to use the rust Embed implement struct as an object you can clone and pass around but the rust_embed Embed interface has all it's method as non-attached (they do not use self) so you cant really use them as an object you can pass around (I assume for performance reasons).

The directorate crate exists to attempt to provide a way to do so:

use directorate::Directorate;

#[derive(rust_embed::Embed, Default)]
#[folder = "test_directory/"]
struct Directory;

let generator = Directorate::<Directory>::default();
let readme_file = generator.get_file("README.md");

Dependencies

~1.6–9MB
~62K SLoC