Skip to content

Instantly share code, notes, and snippets.

@eduardonunesp
Created January 4, 2022 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eduardonunesp/d284c57128b3ed20944f91451123dc92 to your computer and use it in GitHub Desktop.
Save eduardonunesp/d284c57128b3ed20944f91451123dc92 to your computer and use it in GitHub Desktop.
// literals
let byte_data = b"This is a string of bytes";
let raw_string = r##"This "can" have weird \"characters" in it 'no' problem"##;
let raw_byte = br##"you can even mix and match"##;
// Convert to bytes
let data = "abcdefghijklmnopqrstuvwxyz";
let data_ref = data.as_bytes();
let data_owned = data.into_bytes();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment