This account sole purpose is 1 response and its disposable;
Idea - Burner Trait
- Why needed
- Overcome orphan rule when implementing functions to foreign types (most notoriously primitive types)
- When you don’t care about using this trait’s name in the future to bound generics
- Syntax
- In current rust compiler most simply
is an error saying “error: expected identifier, found reserved identifier ‘_’”imp _ for SomeType - This in the future shouldn’t be an error but a feature that is you can’t bound a generic (e.g T: _) SINCE is a Burner Trait. Its sole purpose to implement foreign types with associated functions (and possibly associated types) to “circumvent” the orphan rule
- ‘A macro would do’
- Yes you are correct that a macro would do the job but I counter argue that simply typing first hand
Is easier than implementing the macro yourself. You can counter argue that “use a lib” would do but some people are the kind of people that prefer to be “minimal dependencies or zero” and such reason is probably due to security concern for depending on libs in general and as such when its update automatically on the dependency and if then becomes malicious like secretly key logging etc, they’re have no awareness as such is happening.impl _ for u8,
Note: reserved; It mentions “reserved” meaning either there was SIMILAR IDEA to mine without me realising or B, an identifier that shouldn’t be there as rust compiler does this in the form of a error
Edit: Realising the error is actually expected trait when changing to “impl _ to u8”, found type but still the reserved identifier means something