X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihed-cros-libva%2Fsrc%2Fgeneric_value.rs;h=989773d1cfe84fecfd28b9a41071180c50dc226a;hb=49bf1d79384ecf1b28822101233719fb1c1b29b1;hp=3900edc97b292fda9cf4fd1777fe2e3c7f1641e4;hpb=683627242f69bed0b818d976d4b03d651e529697;p=nihav-player.git diff --git a/nihed-cros-libva/src/generic_value.rs b/nihed-cros-libva/src/generic_value.rs index 3900edc..989773d 100644 --- a/nihed-cros-libva/src/generic_value.rs +++ b/nihed-cros-libva/src/generic_value.rs @@ -2,10 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -use anyhow::anyhow; -use anyhow::Result; - use crate::bindings; +use crate::status::VAError; /// A wrapper over `VAGenericValue` giving us safe access to the underlying union members. #[derive(Debug)] @@ -21,7 +19,7 @@ pub enum GenericValue { } impl TryFrom for GenericValue { - type Error = anyhow::Error; + type Error = VAError; fn try_from(value: bindings::VAGenericValue) -> Result { // Safe because we check the type before accessing the union. @@ -39,10 +37,7 @@ impl TryFrom for GenericValue { bindings::VAGenericValueType::VAGenericValueTypeFunc => { Ok(Self::Func(unsafe { value.value.fn_ })) } - other => Err(anyhow!( - "Conversion failed for unexpected VAGenericValueType: {}", - other - )), + _other => Err(VAError::InvalidValue), } } }