Closed billtong closed 1 year ago
The implementation of this crate uses macro_rules!
and as far as I know, there is no way for such macros to check whether there is a #[deprecated]
annotation above their invocation site. There might be a way with procedural macros, I'm not sure, but even if there is, it wouldn't be worth rewriting this whole crate just to get this one feature.
Another potential option would be to make this a parameter, something like
define_layout!(tlv_header, LittleEndian, deprecated, {...})
but to be honest, I find this syntax too complicated and not worth the benefit.
One thing you could do is wrap tlv_header::View
into your own struct, use that in your codebase instead of using tlv_header::View
directly, and mark that one as deprecated:
// This is private and not exported from your module
define_layout!(tlv_header, LittleEndian, {
tlv_type: u16,
tlv_size: u16,
});
// And this is exported
#[deprecated]
pub struct TlvHeader(tlv_header::View)
I'm closing this issue for now because I don't see an ergonomic way to implement this feature within the library, but feel free to reopen if you have ideas.
Thanks for the detailed explanation! Wrap it in a struct tuple looks reasonable to me.
When compile it shows the warning.
I'd like to know if there is any solution for this.