Skip to main content

ObjectMap

Struct ObjectMap 

Source
pub struct ObjectMap { /* private fields */ }
Expand description

The object tree for one driver, materialised from its DeviceSpec.

Holds the spec plus the AudioObjectIds assigned to the device and its streams. Construct it with ObjectMap::new; the framework builds one when the HAL first asks the plug-in for its object tree, and the property dispatcher consults it on every property call.

Implementations§

Source§

impl ObjectMap

Source

pub fn new(spec: DeviceSpec) -> Self

Build the object tree for spec, assigning ids from AudioObjectId::FIRST_DYNAMIC onwards.

The device takes the first id; the streams follow in input-then-output order, skipping a direction the device does not have.

Source

pub fn spec(&self) -> &DeviceSpec

The driver’s DeviceSpec.

Source

pub const fn plugin_id(&self) -> AudioObjectId

The plug-in object’s id — always AudioObjectId::PLUGIN.

Source

pub const fn device_id(&self) -> AudioObjectId

The device object’s id.

Source

pub const fn stream_id( &self, direction: StreamDirection, ) -> Option<AudioObjectId>

The id of the stream carrying direction, or None if the device has no such stream.

Source

pub fn stream_spec(&self, direction: StreamDirection) -> Option<StreamSpec>

The StreamSpec for direction, or None if the device has no such stream.

Source

pub fn resolve(&self, id: AudioObjectId) -> Option<Object>

Resolve an AudioObjectId to the Object it names, or None if the id is not part of this tree.

Source

pub fn contains(&self, id: AudioObjectId) -> bool

true iff id is part of this tree.

Source

pub fn all_ids(&self) -> Vec<AudioObjectId>

Every AudioObjectId in the tree, in tree order: plug-in, device, then streams.

Source

pub fn owned_objects( &self, id: AudioObjectId, scope: PropertyScope, ) -> Vec<AudioObjectId>

The objects id owns (its children in the tree), filtered to scope.

An id not in the tree, or a scope that does not apply, yields an empty list.

Source

pub fn device_streams(&self, scope: PropertyScope) -> Vec<AudioObjectId>

The device’s stream ids, filtered to scope.

PropertyScope::GLOBAL returns every stream (input first, then output); PropertyScope::INPUT / PropertyScope::OUTPUT return just that direction’s stream. Any other scope yields an empty list.

Source

pub fn owner_of(&self, id: AudioObjectId) -> Option<AudioObjectId>

The id of the object that owns id (its parent in the tree): the device for a stream, the plug-in for the device, AudioObjectId::UNKNOWN for the plug-in (it has no owner), and None for an id not in the tree.

Trait Implementations§

Source§

impl Clone for ObjectMap

Source§

fn clone(&self) -> ObjectMap

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ObjectMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ObjectMap

Source§

fn eq(&self, other: &ObjectMap) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ObjectMap

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.