Hi,
I'm looking for marking some enum variants as deprecated. A snippet of the code:
/// The public key algorithm used by an OpenPGP key.
#[pyclass(eq, skip_from_py_object)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum PublicKeyAlgorithm {
/// RSA (Encrypt or Sign)
RSAEncryptSign,
/// RSA Encrypt-Only, deprecated
#[deprecated]
RSAEncrypt,
}
Sadly currently this triggers deprecation warnings which cannot be silenced at the enum-variant level (only on module level, this is related to #4316 I think).
#4364 adds a better option for functions: #[pyo3(warn):
#[getter]
#[pyo3(warn(
message = "Prefer Sig.issuer_fingerprint",
category = pyo3::exceptions::PyDeprecationWarning
))]
pub fn issuer_fpr(&self) -> Option<String> {
self.issuer_fingerprint()
}
It doesn't seem to work on enum variants though, printing "error: expected name or constructor". I'm not sure if that's a technical limitation or just something not implemented yet but I think it'd be good idea to extend the pyo3 warn support to enum variants too.
Thanks for such a great library, it makes writing python bindings in Rust a true bliss! ❤️
Hi,
I'm looking for marking some enum variants as deprecated. A snippet of the code:
Sadly currently this triggers deprecation warnings which cannot be silenced at the enum-variant level (only on module level, this is related to #4316 I think).
#4364 adds a better option for functions:
#[pyo3(warn):It doesn't seem to work on enum variants though, printing "error: expected
nameorconstructor". I'm not sure if that's a technical limitation or just something not implemented yet but I think it'd be good idea to extend the pyo3 warn support to enum variants too.Thanks for such a great library, it makes writing python bindings in Rust a true bliss! ❤️