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:
@@ -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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|||||||
Reference in New Issue
Block a user