Macro include_crypt::include_dir[][src]

macro_rules! include_dir {
    (XOR, $path:expr) => { ... };
    (AES, $path:expr) => { ... };
    ($path:expr) => { ... };
}
Expand description

Macro that can be used to safely embed a folder into the binary.

Parameters

The macro can be used with different encryption algorithms.

include_dir!($encryption_type, $folder_path)
  • $encryption_type: The type of the encryption. Either XOR or AES. If you don’t specify an encryption type, XOR will be used.
  • $folder_path: The path to the folder that should be embedded. If the path is relative, the CARGO_MANIFEST_DIR will be used as a starting point.

Returns

The macro expands to a include_files proc macro call. The return value will then be used to create a new EncryptedFolder instance.

Examples

// Encrypt using XOR with random key
let folder: EncryptedFolder = include_dir!("./src");

// Encrypt using XOR with random key
let folder: EncryptedFolder = include_dir!(XOR, "./src");

// Encrypt using AES with random key
let folder: EncryptedFolder = include_dir!(AES, "./src");

You can also use absolute paths:

let folder: EncryptedFolder = include_dir!("D:/assets");