#[cfg(any(doc, feature = "pa_v6"))]
use std::ffi::CStr;
use bitflags::bitflags;
bitflags! {
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[repr(transparent)]
pub struct FlagSet: i32 {
const OUTPUT = capi::PA_DIRECTION_OUTPUT;
const INPUT = capi::PA_DIRECTION_INPUT;
}
}
impl FlagSet {
#[inline]
#[cfg(any(doc, feature = "pa_v6"))]
#[cfg_attr(docsrs, doc(cfg(feature = "pa_v6")))]
pub fn is_valid(self) -> bool {
unsafe { capi::pa_direction_valid(self.bits()) != 0 }
}
#[inline]
#[cfg(any(doc, feature = "pa_v6"))]
#[cfg_attr(docsrs, doc(cfg(feature = "pa_v6")))]
pub fn to_string(self) -> String {
unsafe {
CStr::from_ptr(capi::pa_direction_to_string(self.bits())).to_string_lossy().into_owned()
}
}
}