• 0xDEADBEEFCAFE
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    Number 4 is only about not returning impl Into and instead just returning T.

    • KillTheMule
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Hmm, right. I think it still might be warranted in niche cases, but trying to think of such a case made it pretty protracted in my head… maybe when functions can also be called for side effects, and the into conversion is costly and the caller might not care about the return value?

      • anton@lemmy.blahaj.zone
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Such a case would be the single function having a side effect*. This allows the caller to chose when to execute the side effect or to drop the result without executing it.

        In my opinion that is fine with fn_once but not into because of the implicit contract of these traits.

        * = I’m counting expensive computation, but not allocation and memcopy as a side effect in this comment.