2 releases

0.1.1 Apr 28, 2023
0.1.0 Apr 25, 2023

#1176 in Embedded development

Download history 2/week @ 2024-11-27 9/week @ 2024-12-04 14/week @ 2024-12-11 1/week @ 2024-12-18 7/week @ 2025-01-15 7/week @ 2025-02-05 34/week @ 2025-02-12 28/week @ 2025-02-19 6/week @ 2025-02-26

75 downloads per month

MIT license

4KB

Embeddy

License Cargo Version Cargo Downloads

Minimal opinionated resource embedding

Files are loaded relative to the Cargo.toml file

Example Usage

use embeddy::Embedded;

/// Contains all the files stored in the "test" folder 
/// use the [`Embedded::get`] method to access the folders
#[derive(Embedded)]
#[folder = "test"]
struct MyResources;

fn main() {
    let file: Option<&'static [u8]> = MyResources::get("test.txt");
    let nested_file: Option<&'static [u8]> = MyResources::get("sub/test.txt");
}

lib.rs:

Embedding

To embed a folder simply derive the Embedded trait on a struct and set the folder attribute to the folder path relative to the project Cargo.toml

use embeddy::Embedded;

#[derive(Embedded)]
#[folder = "test"]
struct MyResources;

fn main() {
    let file: Option<&'static [u8]> = MyResources::get("test.txt");
}

Dependencies

~0.3–7MB
~49K SLoC