Load A Directory Of Static Files Into Rust
This is how I'm pulling in static files from a directory into Rust binaries.
---
include_dir =
---
use ;
static INCLUDES_DIR: = include_dir!;
Output:
FILE:
2.txt
CONTENTS:
this is a second test file
FILE:
1.txt
CONTENTS:
this is a test file
Notes
-
The documentation says:
When invoking the include_dir!() macro you should try to avoid using relative paths because rustc makes no guarantees about u the current directory when it is running a procedural macro.
I haven't had problem with that yet.
-- end of line --