// 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)]
}
impl TryFrom<bindings::VAGenericValue> for GenericValue {
- type Error = anyhow::Error;
+ type Error = VAError;
fn try_from(value: bindings::VAGenericValue) -> Result<Self, Self::Error> {
// Safe because we check the type before accessing the union.
bindings::VAGenericValueType::VAGenericValueTypeFunc => {
Ok(Self::Func(unsafe { value.value.fn_ }))
}
- other => Err(anyhow!(
- "Conversion failed for unexpected VAGenericValueType: {}",
- other
- )),
+ _other => Err(VAError::InvalidValue),
}
}
}