dir-embed 0.3.0

Like include_bytes! for directories
Documentation
use dir_embed::Embed;

#[derive(Embed)]
#[dir = "./../testdata/bytes/"]
#[mode = "bytes"]
pub struct Assets;

#[test]
fn byte_get() {
    assert!(Assets::get("file1.txt").is_some());
}

#[test]
fn byte_get_missing() {
    assert!(Assets::get("missing.txt").is_none());
}

#[test]
fn byte_read_content() {
    let content_should = "file1".as_bytes();
    let content_is = Assets::get("file1.txt").unwrap();
    assert_eq!(*content_is, *content_should);
}

#[test]
fn byte_parse_string() {
    let file: &[u8] = Assets::get("file1.txt").expect("Can't find file");
    let string = str::from_utf8(file).expect("Failed to parse file");

    assert_eq!(string, "file1");
}

#[test]
fn byte_sub_directories_get() {
    assert!(Assets::get("sub/file2.txt").is_some());
}

#[test]
fn byte_sub_directories_content() {
    let content_should = "file2".as_bytes();
    let content_is = Assets::get("sub/file2.txt").unwrap();
    assert_eq!(*content_is, *content_should);
}

#[test]
fn byte_read_bin() {
    let file = Assets::get("bin").unwrap();
    assert_eq!(file, [0xDE, 0xAD, 0xBE, 0xEF]);
}