Coverage Report

Created: 2022-07-04 16:17

src/client/profiles.rs
Line
Count
Source
1
use super::Client;
2
use crate::{
3
    requests::profiles::{Request, SetParameter},
4
    responses::profiles as responses,
5
    Result,
6
};
7
8
/// API functions related to profiles.
9
pub struct Profiles<'a> {
10
    pub(super) client: &'a Client,
11
}
12
13
impl<'a> Profiles<'a> {
14
    /// Gets an array of all profiles.
15
19
    pub async fn list(&self) -> Result<responses::Profiles> {
<obws::client::profiles::Profiles>::list
Line
Count
Source
15
19
    pub async fn list(&self) -> Result<responses::Profiles> {
Unexecuted instantiation: <obws::client::profiles::Profiles>::list
16
38
        
self.client.send_message(Request::List)19
.await
17
19
    }
<obws::client::profiles::Profiles>::list::{closure#0}
Line
Count
Source
16
38
        
self.client.send_message(Request::List)19
.await
17
19
    }
Unexecuted instantiation: <obws::client::profiles::Profiles>::list::{closure#0}
Unexecuted instantiation: <obws::client::profiles::Profiles>::list::{closure#0}
18
19
    /// Get the currently active profile name.
20
1
    pub async fn current(&self) -> Result<String> {
<obws::client::profiles::Profiles>::current
Line
Count
Source
20
1
    pub async fn current(&self) -> Result<String> {
Unexecuted instantiation: <obws::client::profiles::Profiles>::current
21
1
        self.client
22
2
            .send_message::<_, responses::Profiles>(Request::List)
23
2
            .await
24
1
            .map(|p| p.current)
<obws::client::profiles::Profiles>::current::{closure#0}::{closure#0}
Line
Count
Source
24
1
            .map(|p| p.current)
Unexecuted instantiation: <obws::client::profiles::Profiles>::current::{closure#0}::{closure#0}
Unexecuted instantiation: <obws::client::profiles::Profiles>::current::{closure#0}::{closure#0}
25
1
    }
<obws::client::profiles::Profiles>::current::{closure#0}
Line
Count
Source
21
1
        self.client
22
2
            .send_message::<_, responses::Profiles>(Request::List)
23
2
            .await
24
1
            .map(|p| p.current)
25
1
    }
Unexecuted instantiation: <obws::client::profiles::Profiles>::current::{closure#0}
Unexecuted instantiation: <obws::client::profiles::Profiles>::current::{closure#0}
26
27
    /// Switches to a profile.
28
2
    pub async fn set_current(&self, name: &str) -> Result<()> {
<obws::client::profiles::Profiles>::set_current
Line
Count
Source
28
2
    pub async fn set_current(&self, name: &str) -> Result<()> {
Unexecuted instantiation: <obws::client::profiles::Profiles>::set_current
29
4
        
self.client.send_message(Request::SetCurrent { name })2
.await
30
2
    }
<obws::client::profiles::Profiles>::set_current::{closure#0}
Line
Count
Source
29
4
        
self.client.send_message(Request::SetCurrent { name })2
.await
30
2
    }
Unexecuted instantiation: <obws::client::profiles::Profiles>::set_current::{closure#0}
Unexecuted instantiation: <obws::client::profiles::Profiles>::set_current::{closure#0}
31
32
    /// Creates a new profile, switching to it in the process.
33
1
    pub async fn create(&self, name: &str) -> Result<()> {
<obws::client::profiles::Profiles>::create
Line
Count
Source
33
1
    pub async fn create(&self, name: &str) -> Result<()> {
Unexecuted instantiation: <obws::client::profiles::Profiles>::create
34
2
        
self.client.send_message(Request::Create { name })1
.await
35
1
    }
<obws::client::profiles::Profiles>::create::{closure#0}
Line
Count
Source
34
2
        
self.client.send_message(Request::Create { name })1
.await
35
1
    }
Unexecuted instantiation: <obws::client::profiles::Profiles>::create::{closure#0}
Unexecuted instantiation: <obws::client::profiles::Profiles>::create::{closure#0}
36
37
    /// Removes a profile. If the current profile is chosen, it will change to a different profile
38
    /// first.
39
1
    pub async fn remove(&self, name: &str) -> Result<()> {
<obws::client::profiles::Profiles>::remove
Line
Count
Source
39
1
    pub async fn remove(&self, name: &str) -> Result<()> {
Unexecuted instantiation: <obws::client::profiles::Profiles>::remove
40
2
        
self.client.send_message(Request::Remove { name })1
.await
41
1
    }
<obws::client::profiles::Profiles>::remove::{closure#0}
Line
Count
Source
40
2
        
self.client.send_message(Request::Remove { name })1
.await
41
1
    }
Unexecuted instantiation: <obws::client::profiles::Profiles>::remove::{closure#0}
Unexecuted instantiation: <obws::client::profiles::Profiles>::remove::{closure#0}
42
43
    /// Gets a parameter from the current profile's configuration.
44
1
    pub async fn parameter(
45
1
        &self,
46
1
        category: &str,
47
1
        name: &str,
48
1
    ) -> Result<responses::ProfileParameter> {
<obws::client::profiles::Profiles>::parameter
Line
Count
Source
44
1
    pub async fn parameter(
45
1
        &self,
46
1
        category: &str,
47
1
        name: &str,
48
1
    ) -> Result<responses::ProfileParameter> {
Unexecuted instantiation: <obws::client::profiles::Profiles>::parameter
49
1
        self.client
50
2
            .send_message(Request::Parameter { category, name })
51
2
            .await
52
1
    }
<obws::client::profiles::Profiles>::parameter::{closure#0}
Line
Count
Source
49
1
        self.client
50
2
            .send_message(Request::Parameter { category, name })
51
2
            .await
52
1
    }
Unexecuted instantiation: <obws::client::profiles::Profiles>::parameter::{closure#0}
Unexecuted instantiation: <obws::client::profiles::Profiles>::parameter::{closure#0}
53
54
    /// Sets the value of a parameter in the current profile's configuration.
55
2
    pub async fn set_parameter(&self, parameter: SetParameter<'_>) -> Result<()> {
<obws::client::profiles::Profiles>::set_parameter
Line
Count
Source
55
2
    pub async fn set_parameter(&self, parameter: SetParameter<'_>) -> Result<()> {
Unexecuted instantiation: <obws::client::profiles::Profiles>::set_parameter
56
2
        self.client
57
4
            .send_message(Request::SetParameter(parameter))
58
4
            .await
59
2
    }
<obws::client::profiles::Profiles>::set_parameter::{closure#0}
Line
Count
Source
56
2
        self.client
57
4
            .send_message(Request::SetParameter(parameter))
58
4
            .await
59
2
    }
Unexecuted instantiation: <obws::client::profiles::Profiles>::set_parameter::{closure#0}
Unexecuted instantiation: <obws::client::profiles::Profiles>::set_parameter::{closure#0}
60
}