Created
March 2, 2022 18:50
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[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