cubeb 0.4.1

Bindings to libcubeb for interacting with system audio from rust.
Documentation
// Copyright © 2017-2018 Mozilla Foundation
//
// This program is made available under an ISC-style license.  See the
// accompanying file LICENSE for details.

use Error;
use std::os::raw::c_int;

pub fn cvt_r(ret: c_int) -> Result<(), Error> {
    match ret {
        n if n < 0 => Err(unsafe { Error::from_raw(n) }),
        _ => Ok(()),
    }
}

macro_rules! try_call {
    (raw::$p:ident ($($e:expr),*)) => ({
        match ::try_call::cvt_r(ffi::$p($($e),*)) {
            Ok(o) => o,
            Err(e) => { return Err(e) }
        }
    })
}