Read file into const

Hi folks!

I swear I've used this in the past, but have no clue what it would be. I've done a lot of googling, but everything brings up reasonable and good ways of reading files.

Anyway, I'd like to hard code a bunch of text into my program, for fun, and because I want the text to come built into the binary, not be read by fs::read_to_string() or the various alternatives.

I remember it being something like const input: u8 = read_in!["my_file.txt"]

I'm pretty sure it was a macro?

I don't really care what type of data it reads in (u8, &str, Vec), I can handle that during run time, I just want to hard code a bunch of text, without actually putting it in the .rs files.

Anyway, thank you

Nevermind, while typing this I remembed it was a macro, and then I instantly ran into this friend which is exactly what I want!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.