GeistHaus
log in · sign up

Daily Rust: Slice Patterns

adventures.michaelfbryan.com

Rust 1.26 introduced a nifty little feature called Basic Slice Patterns which lets you pattern match on slices with a known length. Later on in Rust 1.42, this was extended to allow using .. to match on “everything else”. As features go this may seem like a small addition, but it gives developers an opportunity to write much more expressive code. The code written in this article is available in the various playground links dotted throughout. Feel free to browse through and steal code or inspiration.

0 pages link to this URL

No pages have linked to this URL yet.