Created
July 4, 2024 05:11
-
-
Save DefectingCat/3e68ddb67969763df49423a9a5376f61 to your computer and use it in GitHub Desktop.
rust at operator binding
This file contains 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
fn main() { | |
let strs = ["hello world", "1", "hello", "world"]; | |
let mut remaining: &[&str] = &strs; | |
while let [current, tail @ ..] = remaining { | |
println!("{} - {:?}", current, tail); | |
remaining = tail; | |
} | |
println!("The real strs {:?}", strs); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment