Match on enum reference in ffi.

This commit is contained in:
Henri Sivonen
2016-01-20 13:04:45 +02:00
parent 72f2bbf8fa
commit b76b2c82f6
+11 -11
View File
@@ -15,29 +15,29 @@ const OUTPUT_FULL: u32 = 0xFFFFFFFE;
impl WithReplacementResult {
fn as_u32(&self) -> u32 {
match *self {
WithReplacementResult::InputEmpty => INPUT_EMPTY,
WithReplacementResult::OutputFull => OUTPUT_FULL,
match self {
&WithReplacementResult::InputEmpty => INPUT_EMPTY,
&WithReplacementResult::OutputFull => OUTPUT_FULL,
}
}
}
impl DecoderResult {
fn as_u32(&self) -> u32 {
match *self {
DecoderResult::InputEmpty => INPUT_EMPTY,
DecoderResult::OutputFull => OUTPUT_FULL,
DecoderResult::Malformed(num) => num as u32,
match self {
&DecoderResult::InputEmpty => INPUT_EMPTY,
&DecoderResult::OutputFull => OUTPUT_FULL,
&DecoderResult::Malformed(num) => num as u32,
}
}
}
impl EncoderResult {
fn as_u32(&self) -> u32 {
match *self {
EncoderResult::InputEmpty => INPUT_EMPTY,
EncoderResult::OutputFull => OUTPUT_FULL,
EncoderResult::Unmappable(c) => c as u32,
match self {
&EncoderResult::InputEmpty => INPUT_EMPTY,
&EncoderResult::OutputFull => OUTPUT_FULL,
&EncoderResult::Unmappable(c) => c as u32,
}
}
}