Coverage Report

Created: 2022-07-04 16:17

src/client/hotkeys.rs
Line
Count
Source
1
use super::Client;
2
use crate::{
3
    requests::hotkeys::{KeyModifiers, Request},
4
    responses::hotkeys as responses,
5
    Result,
6
};
7
8
/// API functions related to hotkeys.
9
pub struct Hotkeys<'a> {
10
    pub(super) client: &'a Client,
11
}
12
13
impl<'a> Hotkeys<'a> {
14
    /// Gets an array of all hotkey names in OBS.
15
1
    pub async fn list(&self) -> Result<Vec<String>> {
<obws::client::hotkeys::Hotkeys>::list
Line
Count
Source
15
1
    pub async fn list(&self) -> Result<Vec<String>> {
Unexecuted instantiation: <obws::client::hotkeys::Hotkeys>::list
16
1
        self.client
17
2
            .send_message::<_, responses::Hotkeys>(Request::List)
18
2
            .await
19
1
            .map(|h| h.hotkeys)
<obws::client::hotkeys::Hotkeys>::list::{closure#0}::{closure#0}
Line
Count
Source
19
1
            .map(|h| h.hotkeys)
Unexecuted instantiation: <obws::client::hotkeys::Hotkeys>::list::{closure#0}::{closure#0}
Unexecuted instantiation: <obws::client::hotkeys::Hotkeys>::list::{closure#0}::{closure#0}
20
1
    }
<obws::client::hotkeys::Hotkeys>::list::{closure#0}
Line
Count
Source
16
1
        self.client
17
2
            .send_message::<_, responses::Hotkeys>(Request::List)
18
2
            .await
19
1
            .map(|h| h.hotkeys)
20
1
    }
Unexecuted instantiation: <obws::client::hotkeys::Hotkeys>::list::{closure#0}
Unexecuted instantiation: <obws::client::hotkeys::Hotkeys>::list::{closure#0}
21
22
    /// Triggers a hotkey using its name. See [`Self::list`].
23
1
    pub async fn trigger_by_name(&self, name: &str) -> Result<()> {
<obws::client::hotkeys::Hotkeys>::trigger_by_name
Line
Count
Source
23
1
    pub async fn trigger_by_name(&self, name: &str) -> Result<()> {
Unexecuted instantiation: <obws::client::hotkeys::Hotkeys>::trigger_by_name
24
1
        self.client
25
2
            .send_message(Request::TriggerByName { name })
26
2
            .await
27
1
    }
<obws::client::hotkeys::Hotkeys>::trigger_by_name::{closure#0}
Line
Count
Source
24
1
        self.client
25
2
            .send_message(Request::TriggerByName { name })
26
2
            .await
27
1
    }
Unexecuted instantiation: <obws::client::hotkeys::Hotkeys>::trigger_by_name::{closure#0}
Unexecuted instantiation: <obws::client::hotkeys::Hotkeys>::trigger_by_name::{closure#0}
28
29
    /// Triggers a hotkey using a sequence of keys.
30
1
    pub async fn trigger_by_sequence(&self, id: &str, modifiers: KeyModifiers) -> Result<()> {
<obws::client::hotkeys::Hotkeys>::trigger_by_sequence
Line
Count
Source
30
1
    pub async fn trigger_by_sequence(&self, id: &str, modifiers: KeyModifiers) -> Result<()> {
Unexecuted instantiation: <obws::client::hotkeys::Hotkeys>::trigger_by_sequence
31
1
        self.client
32
2
            .send_message(Request::TriggerBySequence { id, modifiers })
33
2
            .await
34
1
    }
<obws::client::hotkeys::Hotkeys>::trigger_by_sequence::{closure#0}
Line
Count
Source
31
1
        self.client
32
2
            .send_message(Request::TriggerBySequence { id, modifiers })
33
2
            .await
34
1
    }
Unexecuted instantiation: <obws::client::hotkeys::Hotkeys>::trigger_by_sequence::{closure#0}
Unexecuted instantiation: <obws::client::hotkeys::Hotkeys>::trigger_by_sequence::{closure#0}
35
}