#Deriving a trait outside of the struct definition

1 messages · Page 1 of 1 (latest)

cloud spindle
#

I'm wondering if its possible to define a struct like struct Number(i32) and then in another module derive a Default impl (without actually just doing impl Default for....)

naive onyx
#

no

vestal root
#

In general, nothing can ever have information about the definition of a struct (or other type) without either:

  • being a macro applied to that struct definition directly
  • making use of a trait that was already implemented for that struct