Skip to content

Instantly share code, notes, and snippets.

@haxpor
Created March 2, 2022 18:50
Show Gist options
  • Save haxpor/8cd77231967a12966a32f970fe411d2b to your computer and use it in GitHub Desktop.
Save haxpor/8cd77231967a12966a32f970fe411d2b to your computer and use it in GitHub Desktop.
Use .0 .1 and so on to access unnamed field from the specified arguments to one-line struct declaration
#[derive(Debug)]
struct Token(usize, usize);
fn main() {
let token = Token(1, 2);
println!("{} {}", token.0, token.1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment