feat(tonic): implement From<Code> for i32

`Code` is already trivial to convert into an `i32` however that isn't
immediately obvious by looking at the docs. This has tripped me up
before.

Implementing `From<Code>` for `i32` should hopefully make it a bit more
obvious.
This commit is contained in:
David Pedersen
2021-05-12 16:42:23 +02:00
committed by GitHub
parent c39404d720
commit f33316d5b3
+7
View File
@@ -754,6 +754,13 @@ impl From<i32> for Code {
}
}
impl From<Code> for i32 {
#[inline]
fn from(code: Code) -> i32 {
code as i32
}
}
#[cfg(test)]
mod tests {
use super::*;