4 ms·
You're right that it's not an ideal example. I think I said that in the post. The context of the article was the week I spent with Rust and the project I actual
by relistan 13y ago
You're right that it's not an ideal example. I think I said that in the post. The context of the article was the week I spent with Rust and the project I actually did with it. There was not a better example in my code to show. I could have contrived something, but it wasn't really in spirit of what I was writing about.
- klibertp 13y agoYou probably should fix this in your code too. As noted in this thread, that's not a proper way to use pattern matching. Anyone reading your code will be confused by this usage and that's not a good thing. It probably would be best to use this: match key.cmp(self.block_size) { Equal => .. Greater => .. Less => ... } Which is much prettier (and more succinct) than both your original code and my example. You could also use a `cond!()` macro here, but that would mean you don't have an example for a blog post, so I think the above code is the best option. Thanks to kzrdude for posting.