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. EitherXORorAES. If you don’t specify an encryption type,XORwill be used.$folder_path: The path to the folder that should be embedded. If the path is relative, theCARGO_MANIFEST_DIRwill 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");