Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to embed resources in Rust executable?

Tags:

This is the cousin of this question over here asking the same thing for C.

Basically, is there a better way than to just turn it into a giant byte array and putting it in a source file?

Alternatively, does a macro have the ability to do this? (Rust Macros... are a dense looking and their exact capabilities are not known to me.)

like image 978
Logan Avatar asked Nov 26 '14 03:11

Logan


1 Answers

You probably want include_bytes!.

If you are in older versions of Rust, use include_bin! instead.

like image 155
DK. Avatar answered Oct 14 '22 13:10

DK.