Re: [PATCH v4 3/3] rust: error: Replace pr_warn by pr_warn_once
From: jens . korinth
Date: Thu Dec 05 2024 - 14:22:57 EST
> Sorry, I am confused. This is not implementing the `From` trait, it is
> an inherent implementation.
Hmm, you're right. I assume there is a reason why it doesn't implement
`From<c_int>` or `TryFrom<c_int>`?
> If what you mean is that this should not be an infallible operation,
> then we are back at my previous reply, i.e. are you suggesting to
> remove the method? Could you please clarify, perhaps with an example?
Yes, I meant to say it should not be infallible, because, well, it isn't. :)
I'd probably make `try_from_errno` public and remove `from_errno`.
If there's no other disadvantage I'd remove `try_from_errno` as well and
replace it by `TryFrom<c_int>`. Implementing `From<Error> for c_int` may
also make sense for the other direction?
Jens