<re_irc>
<@boiethios:matrix.org> I write a lib to be consumed by controllers. Can I implement "Debug" for all my types without the final binary growing in size? If the debug implementations aren't used, are they stripped out from the binary?
<re_irc>
<@boiethios:matrix.org> I assume so, but I'd rather be 100% sure
<re_irc>
<@therealprof:matrix.org> The "Debug" implementation will only materialise in binary code if it's actually used.
<re_irc>
<@therealprof:matrix.org> The "danger" about doing this is that people might accidentally use it and wonder why their application gets bloated. If you don't implement that, they'll get an error instead.
<re_irc>
<@boiethios:matrix.org> Maybe I can put that behind a feature?
<re_irc>
<@therealprof:matrix.org> If you think a type makes sense to be formatted outside of debugging output I'd recommend to implement "Display" instead.
<re_irc>
<@boiethios:matrix.org> * It's worth it putting
<re_irc>
<@boiethios:matrix.org> I only use their display during debugging
<re_irc>
<@therealprof:matrix.org> Not sure it's possible to feature gate auto-impls, I don't think it is.
<re_irc>
<@boiethios:matrix.org> It is
<re_irc>
<@boiethios:matrix.org> * is, IIRC
<re_irc>
<@boiethios:matrix.org> with "cfg_attr"
<re_irc>
<@therealprof:matrix.org> Hm, I don't think it is worth the mental overhead.
<re_irc>
<@boiethios:matrix.org> I just verified, this works: "#[cfg_attr(feature = "debug", derive(Debug))]"
<re_irc>
<@therealprof:matrix.org> TIL 😉
<re_irc>
<@therealprof:matrix.org> Manual implementation would provide the benefit of controlling how the formatting is done rather than the built-in formatters which can be quite extensive to provide nice output under any circumstance...
<re_irc>
<@boiethios:matrix.org> I do write a couple of implementation by hand, but the automatic one is good enough for most of the types.