pub struct AudioDevice { /* private fields */ }Expand description
Represents a PulseAudio audio output device.
§Feature flags
Real PulseAudio integration requires the pulseaudio feature and the
libpulse-dev system package. Without the feature every method returns
AudioError::Unsupported.
§Thread safety
When the pulseaudio feature is enabled, AudioDevice is not Send
because it holds a cached PulseAudio connection (Mainloop and
Context from libpulse-binding are !Send). Use on a single thread
only. A threaded-mainloop wrapper that restores Send + Sync may be
added in a future release.
Trait Implementations§
Source§impl AudioDevice for AudioDevice
impl AudioDevice for AudioDevice
Source§fn from_default() -> Result<Self, AudioError>
fn from_default() -> Result<Self, AudioError>
Returns the system default audio output device. Read more
Source§fn from_id(id: &str) -> Result<Self, AudioError>
fn from_id(id: &str) -> Result<Self, AudioError>
Returns the audio device identified by
id. Read moreSource§fn from_name(name: &str) -> Result<Self, AudioError>
fn from_name(name: &str) -> Result<Self, AudioError>
Returns the first audio device whose name contains
name
(case-insensitive substring match). Read moreSource§fn list() -> Result<Vec<DeviceInfo>, AudioError>
fn list() -> Result<Vec<DeviceInfo>, AudioError>
Lists all available audio devices. Read more
Source§fn get_vol(&self) -> Result<u8, AudioError>
fn get_vol(&self) -> Result<u8, AudioError>
Returns the current volume level in the range
0..=100. Read moreSource§fn is_mute(&self) -> Result<bool, AudioError>
fn is_mute(&self) -> Result<bool, AudioError>
Returns
true if the device is currently muted. Read moreSource§impl Debug for AudioDevice
impl Debug for AudioDevice
Auto Trait Implementations§
impl Freeze for AudioDevice
impl !RefUnwindSafe for AudioDevice
impl !Send for AudioDevice
impl !Sync for AudioDevice
impl Unpin for AudioDevice
impl UnsafeUnpin for AudioDevice
impl !UnwindSafe for AudioDevice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more