You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Trait sugar syntax for makertrait and implementing the same maker trait for multiple type #3732
Hello there, here is just a personal suggestion to keep the consistency between declaring a empty struct / marker trait, nothings really important but anyway ^^
structEmpty;// okstructEmpty{}// oktraitSignedInteger;// currently not ok traitSignedInteger{}// okimplSignedIntegerfori8;// currently not okimplSignedIntegerfori8{}// ok
Also, sometime implementing the same maker trait for multiples types can be helpful (instead of using macro) :
implSignedIntegerfori8,i16,i32,i64,isize;// currently not okimplSignedIntegerfori8,i16,i32,i64,isize{}// currently not ok
consistency between declaring a empty struct / marker trait
struct Empty; and struct Empty {} are not equivalent. The former also allows you to create an instance like let x = Empty; which is not possible for the latter.
So there is no "consistency", and it is not an applicable rationale here.
Activity
kennytm commentedon Nov 26, 2024
struct Empty;andstruct Empty {}are not equivalent. The former also allows you to create an instance likelet x = Empty;which is not possible for the latter.So there is no "consistency", and it is not an applicable rationale here.