I see that I can use the #[deprecated] marker, but somehow it is not working in the following workflow:
MyOldStruct
to MyNewStruct
in my library.pub use MyNewStruct as MyOldStruct
.pub struct MyNewStruct{};
#[deprecated]
pub use MyOldStruct as MyNewStruct;
Any ideas what might be going wrong here? I am viewing if it shows as deprecated in cargo docs.
Use a type alias:
#[deprecated]
pub type MyOldStruct = MyNewStruct;
See it emit a warning on the playground.
I will note that using a type alias for renaming and deprecating things doesn't work for everything: an aliased tuple struct can't use the new name construct a value as shown in the docs, and this method obviously doesn't work for traits since they aren't types and we don't have trait aliases yet.