3 ms·
If this were a real API, you would need to add the trimmings: /// Doc comment doc comment doc comment #[derive(Debug, Copy, Clone, Eq, PartialEq)]
by ridiculous_fish 6y ago
If this were a real API, you would need to add the trimmings:
/// Doc comment doc comment doc comment
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum SearchCase { Sensitive, Insensitive }
now it starts to feel like heavyweight clutter.
- simias 6y agoI see what you mean, but if that's the problem I'd argue that the weakness is that Rust lacks a shorthand to declare simple enums, not necessarily that it lacks keyword parameters. #[derive] soup aside I don't think too bad at the moment though, and I'm not really sure how you could simplify that without introducing too much magic into the language. After all, even with keyword parameters there'll always be plenty of opportunity for one-off enums, if only for situations where more than two choices are possible. Take a typical "seek" function for instance, who can usually be performed relative to the current location, from the start or from the end.