Skip to content

Instantly share code, notes, and snippets.

@kriogenia
Created June 3, 2022 12:28
Show Gist options
  • Save kriogenia/33a8c90ae2003db5f8caeb69ab7aa348 to your computer and use it in GitHub Desktop.
Save kriogenia/33a8c90ae2003db5f8caeb69ab7aa348 to your computer and use it in GitHub Desktop.
include_str and include_bytes
const TOKEN_AS_STR: &'static str = include_str!("./token.txt");
const TOKEN_AS_BYTES: &[u8] = include_bytes!("./token.txt");
fn main() {
assert_eq!("HelLoWoRLd", TOKEN_AS_STR);
assert_eq!("HelLoWoRLd".as_bytes(), TOKEN_AS_BYTES);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment