home.social

#impl — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #impl, aggregated by home.social.

  1. I like the second way better too. I also like the idea of splitting the struct and its impls to its own file. Thanks everyone for your input.

    #Rust #Trait #Impl #Struct

  2. In Rust if I have some structs that each implement a couple traits, what is the preferred way to order things?

    trait … {}
    trait …{}

    struct …{}
    struct …{}
    struct …{}

    impl…for …{}
    impl…for …{}
    impl…for …{}
    impl…for …{}
    impl…for …{}
    impl…for …{}

    OR

    trait …{}
    trait …{}

    struct …{}
    impl…for …{}
    impl…for …{}

    struct …{}
    impl…for …{}
    impl…for …{}

    struct …{}
    impl…for …{}
    impl…for …{}

    OR, something else entirely?

    #Rust #Trait #Impl #Struct