Struct Context

Source
pub struct Context(/* private fields */);

Implementations§

Source§

impl Context

Source

pub unsafe fn from_ptr(ptr: *mut cubeb) -> Context

§Safety

This function is unsafe because it dereferences the given ptr pointer. The caller should ensure that pointer is valid.

Source

pub fn as_ptr(&self) -> *mut cubeb

Source§

impl Context

Source

pub fn init( context_name: Option<&CStr>, backend_name: Option<&CStr>, ) -> Result<Context, Error>

Methods from Deref<Target = ContextRef>§

Source

pub fn as_ptr(&self) -> *mut cubeb

Source

pub fn backend_id(&self) -> &str

Source

pub fn backend_id_bytes(&self) -> &[u8]

Source

pub fn max_channel_count(&self) -> Result<u32, Error>

Source

pub fn min_latency(&self, params: &StreamParamsRef) -> Result<u32, Error>

Source

pub fn preferred_sample_rate(&self) -> Result<u32, Error>

Source

pub fn supported_input_processing_params( &self, ) -> Result<InputProcessingParams, Error>

Source

pub unsafe fn stream_init( &self, stream_name: Option<&CStr>, input_device: *const c_void, input_stream_params: Option<&StreamParamsRef>, output_device: *const c_void, output_stream_params: Option<&StreamParamsRef>, latency_frames: u32, data_callback: Option<unsafe extern "C" fn(*mut cubeb_stream, *mut c_void, *const c_void, *mut c_void, i64) -> i64>, state_callback: Option<unsafe extern "C" fn(*mut cubeb_stream, *mut c_void, u32)>, user_ptr: *mut c_void, ) -> Result<Stream, Error>

§Safety

This function is unsafe because it dereferences the given data_callback, state_callback, and user_ptr pointers. The caller should ensure those pointers are valid.

Source

pub fn enumerate_devices( &self, devtype: DeviceType, ) -> Result<DeviceCollection<'_>, Error>

Source

pub unsafe fn register_device_collection_changed( &self, devtype: DeviceType, callback: Option<unsafe extern "C" fn(*mut cubeb, *mut c_void)>, user_ptr: *mut c_void, ) -> Result<(), Error>

§Safety

This function is unsafe because it dereferences the given callback and user_ptr pointers. The caller should ensure those pointers are valid.

Trait Implementations§

Source§

impl AsRef<ContextRef> for Context

Source§

fn as_ref(&self) -> &ContextRef

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<ContextRef> for Context

Source§

fn borrow(&self) -> &ContextRef

Immutably borrows from an owned value. Read more
Source§

impl Deref for Context

Source§

type Target = ContextRef

The resulting type after dereferencing.
Source§

fn deref(&self) -> &ContextRef

Dereferences the value.
Source§

impl DerefMut for Context

Source§

fn deref_mut(&mut self) -> &mut ContextRef

Mutably dereferences the value.
Source§

impl Drop for Context

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.