use std::rc::Rc;
-use anyhow::Result;
-
use crate::bindings;
-use crate::status::Status;
+use crate::status::*;
use crate::Context;
/// Wrapper type representing a buffer created with `vaCreateBuffer`.
impl Buffer {
/// Creates a new buffer by wrapping a `vaCreateBuffer` call. This is just a helper for
/// [`Context::create_buffer`].
- pub(crate) fn new(context: Rc<Context>, mut type_: BufferType) -> Result<Self> {
+ pub(crate) fn new(context: Rc<Context>, mut type_: BufferType) -> VAResult<Self> {
let mut buffer_id = 0;
let (ptr, size) = match type_ {
// Safe because `self` represents a valid `VAContext`. `ptr` and `size` are also ensured to
// be correct, as `ptr` is just a cast to `*c_void` from a Rust struct, and `size` is
// computed from `std::mem::size_of_val`.
- Status(unsafe {
+ (unsafe {
bindings::vaCreateBuffer(
context.display().handle(),
context.id(),
// Safe because `self` represents a valid buffer, created with
// vaCreateBuffers.
let status =
- Status(unsafe { bindings::vaDestroyBuffer(self.context.display().handle(), self.id) })
+ (unsafe { bindings::vaDestroyBuffer(self.context.display().handle(), self.id) })
.check();
if status.is_err() {
println!("vaDestroyBuffer failed: {}", status.unwrap_err());