SourceController

Struct SourceController 

Source
pub struct SourceController {
    pub handler: Handler,
}
Expand description

This handles devices which takes in audio (e.g., microphone), so this is appropriate when manipulating recording devices such as microphone volume.

Fields§

§handler: Handler

Implementations§

Source§

impl SourceController

Source

pub fn create() -> Result<Self, ControllerError>

Examples found in repository?
examples/server_info.rs (line 3)
1fn main() {
2    let mut handler =
3        pulsectl::controllers::SourceController::create().expect("Failed to create handler");
4    let server_info = handler
5        .get_server_info()
6        .expect("Failed to get server info");
7
8    // Get information similar to the output of `pactl info` command
9    println!("User Name: {:?}", server_info.user_name);
10    println!("Host Name: {:?}", server_info.host_name);
11    println!("Server Name: {:?}", server_info.server_name);
12    println!("Server Version: {:?}", server_info.server_version);
13    println!(
14        "Default Sample Specification: {:?}",
15        server_info.sample_spec
16    );
17    println!("Default Channel Map: {:?}", server_info.channel_map);
18    println!("Default Sink: {:?}", server_info.default_sink_name);
19    println!("Default Source: {:?}", server_info.default_source_name);
20    println!("Cookie: {:?}", server_info.cookie);
21}
Source

pub fn get_server_info(&mut self) -> Result<ServerInfo, ControllerError>

Examples found in repository?
examples/server_info.rs (line 5)
1fn main() {
2    let mut handler =
3        pulsectl::controllers::SourceController::create().expect("Failed to create handler");
4    let server_info = handler
5        .get_server_info()
6        .expect("Failed to get server info");
7
8    // Get information similar to the output of `pactl info` command
9    println!("User Name: {:?}", server_info.user_name);
10    println!("Host Name: {:?}", server_info.host_name);
11    println!("Server Name: {:?}", server_info.server_name);
12    println!("Server Version: {:?}", server_info.server_version);
13    println!(
14        "Default Sample Specification: {:?}",
15        server_info.sample_spec
16    );
17    println!("Default Channel Map: {:?}", server_info.channel_map);
18    println!("Default Sink: {:?}", server_info.default_sink_name);
19    println!("Default Source: {:?}", server_info.default_source_name);
20    println!("Cookie: {:?}", server_info.cookie);
21}

Trait Implementations§

Source§

impl AppControl<ApplicationInfo> for SourceController

Source§

fn list_applications(&mut self) -> Result<Vec<ApplicationInfo>, ControllerError>

Source§

fn get_app_by_index( &mut self, index: u32, ) -> Result<ApplicationInfo, ControllerError>

Source§

fn increase_app_volume_by_percent(&mut self, index: u32, delta: f64)

Source§

fn decrease_app_volume_by_percent(&mut self, index: u32, delta: f64)

Source§

fn move_app_by_index( &mut self, stream_index: u32, device_index: u32, ) -> Result<bool, ControllerError>

Source§

fn move_app_by_name( &mut self, stream_index: u32, device_name: &str, ) -> Result<bool, ControllerError>

Source§

fn set_app_mute( &mut self, index: u32, mute: bool, ) -> Result<bool, ControllerError>

Source§

impl DeviceControl<DeviceInfo> for SourceController

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