What is difference between a unit struct and an enum with 0 variants?

98 points Allike 21 comments

Some times when I press goto type definition on a crate dependency I see that the type is an enum with 0 variants. Example in lsp-types. For me it would make more semantic sense to use a unit struct instead for these cases.

Is there a syntactical difference between the two in the type system, or is it more a design preference you can select between as the developer?