Struct SourcePortInfo

Source
pub struct SourcePortInfo<'a> {
    pub name: Option<Cow<'a, str>>,
    pub description: Option<Cow<'a, str>>,
    pub priority: u32,
    pub available: PortAvailable,
    pub availability_group: Option<Cow<'a, str>>,
    pub type: DevicePortType,
}
Expand description

Stores information about a specific port of a source.

Please note that this structure can be extended as part of evolutionary API updates at any time in any new release.

Fields§

§name: Option<Cow<'a, str>>

Name of this port.

§description: Option<Cow<'a, str>>

Description of this port.

§priority: u32

The higher this value is, the more useful this port is as a default.

§available: PortAvailable

A flag indicating availability status of this port.

§availability_group: Option<Cow<'a, str>>
Available on crate feature pa_v14 only.

An indentifier for the group of ports that share their availability status with each other.

This is meant especially for handling cases where one 3.5 mm connector is used for headphones, headsets and microphones, and the hardware can only tell that something was plugged in but not what exactly. In this situation the ports for all those devices share their availability status, and PulseAudio can’t tell which one is actually plugged in, and some application may ask the user what was plugged in. Such applications should get a list of all card ports and compare their availability_group fields. Ports that have the same group are those that need input from the user to determine which device was plugged in. The application should then activate the user-chosen port.

May be None, in which case the port is not part of any availability group (which is the same as having a group with only one member).

The group identifier must be treated as an opaque identifier. The string may look like an ALSA control name, but applications must not assume any such relationship. The group naming scheme can change without a warning.

Since one group can include both input and output ports, the grouping should be done using CardPortInfo instead of SourcePortInfo, but this field is duplicated also in SourcePortInfo (and SinkPortInfo) in case someone finds that convenient.

§type: DevicePortType
Available on crate feature pa_v14 only.

Port device type.

Implementations§

Source§

impl SourcePortInfo<'_>

Source

pub fn to_owned(&self) -> SourcePortInfo<'static>

Creates a copy with owned data.

Trait Implementations§

Source§

impl<'a> Debug for SourcePortInfo<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for SourcePortInfo<'a>

§

impl<'a> RefUnwindSafe for SourcePortInfo<'a>

§

impl<'a> Send for SourcePortInfo<'a>

§

impl<'a> Sync for SourcePortInfo<'a>

§

impl<'a> Unpin for SourcePortInfo<'a>

§

impl<'a> UnwindSafe for SourcePortInfo<'a>

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<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.