Coverage Report

Created: 2022-07-04 16:17

src/requests/hotkeys.rs
Line
Count
Source
1
//! Requests related to hotkeys.
2
3
use serde::Serialize;
4
5
5
#[derive(
S3
eri
aliz2
e)]
Unexecuted instantiation: <obws::requests::hotkeys::Request as serde::ser::Serialize>::serialize::<&mut serde_json::ser::Serializer<&mut alloc::vec::Vec<u8>>>
<obws::requests::hotkeys::Request as serde::ser::Serialize>::serialize::<serde::__private::ser::FlatMapSerializer<serde_json::ser::Compound<&mut alloc::vec::Vec<u8>, serde_json::ser::CompactFormatter>>>
Line
Count
Source
5
3
#[derive(Serialize)]
<<obws::requests::hotkeys::Request as serde::ser::Serialize>::serialize::__AdjacentlyTagged as serde::ser::Serialize>::serialize::<&mut serde_json::ser::Serializer<&mut alloc::vec::Vec<u8>>>
Line
Count
Source
5
1
#[derive(Serialize)]
<<obws::requests::hotkeys::Request as serde::ser::Serialize>::serialize::__AdjacentlyTagged as serde::ser::Serialize>::serialize::<&mut serde_json::ser::Serializer<&mut alloc::vec::Vec<u8>>>
Line
Count
Source
5
1
#[derive(Serialize)]
Unexecuted instantiation: <<obws::requests::hotkeys::Request as serde::ser::Serialize>::serialize::__AdjacentlyTagged as serde::ser::Serialize>::serialize::<_>
Unexecuted instantiation: <<obws::requests::hotkeys::Request as serde::ser::Serialize>::serialize::__AdjacentlyTagged as serde::ser::Serialize>::serialize::<_>
Unexecuted instantiation: <obws::requests::hotkeys::Request as serde::ser::Serialize>::serialize::<_>
Unexecuted instantiation: <<obws::requests::hotkeys::Request as serde::ser::Serialize>::serialize::__AdjacentlyTagged as serde::ser::Serialize>::serialize::<_>
Unexecuted instantiation: <<obws::requests::hotkeys::Request as serde::ser::Serialize>::serialize::__AdjacentlyTagged as serde::ser::Serialize>::serialize::<_>
Unexecuted instantiation: <obws::requests::hotkeys::Request as serde::ser::Serialize>::serialize::<_>
6
#[serde(tag = "requestType", content = "requestData")]
7
pub(crate) enum Request<'a> {
8
    #[serde(rename = "GetHotkeyList")]
9
    List,
10
    #[serde(rename = "TriggerHotkeyByName")]
11
    TriggerByName {
12
        /// Name of the hotkey to trigger.
13
        #[serde(rename = "hotkeyName")]
14
        name: &'a str,
15
    },
16
    #[serde(rename = "TriggerHotkeyByKeySequence")]
17
    TriggerBySequence {
18
        /// The OBS key ID to use.
19
        #[serde(rename = "keyId")]
20
        id: &'a str,
21
        /// Object containing key modifiers to apply.
22
        #[serde(rename = "keyModifiers")]
23
        modifiers: KeyModifiers,
24
    },
25
    // TODO: Sleep
26
}
27
28
impl<'a> From<Request<'a>> for super::RequestType<'a> {
29
3
    fn from(value: Request<'a>) -> Self {
30
3
        super::RequestType::Hotkeys(value)
31
3
    }
<obws::requests::RequestType as core::convert::From<obws::requests::hotkeys::Request>>::from
Line
Count
Source
29
3
    fn from(value: Request<'a>) -> Self {
30
3
        super::RequestType::Hotkeys(value)
31
3
    }
Unexecuted instantiation: <obws::requests::RequestType as core::convert::From<obws::requests::hotkeys::Request>>::from
32
}
33
34
/// Request information for
35
/// [`crate::client::Hotkeys::trigger_by_sequence`].
36
1
#[derive(Default, Serialize)]
<obws::requests::hotkeys::KeyModifiers as core::default::Default>::default
Line
Count
Source
36
1
#[derive(Default, Serialize)]
Unexecuted instantiation: <obws::requests::hotkeys::KeyModifiers as core::default::Default>::default
Unexecuted instantiation: <obws::requests::hotkeys::KeyModifiers as core::default::Default>::default
<obws::requests::hotkeys::KeyModifiers as serde::ser::Serialize>::serialize::<&mut serde_json::ser::Serializer<&mut alloc::vec::Vec<u8>>>
Line
Count
Source
36
1
#[derive(Default, Serialize)]
Unexecuted instantiation: <obws::requests::hotkeys::KeyModifiers as serde::ser::Serialize>::serialize::<_>
Unexecuted instantiation: <obws::requests::hotkeys::KeyModifiers as serde::ser::Serialize>::serialize::<_>
37
pub struct KeyModifiers {
38
    /// Press Shift.
39
    #[serde(rename = "shift")]
40
    pub shift: bool,
41
    /// Press CTRL.
42
    #[serde(rename = "control")]
43
    pub control: bool,
44
    /// Press ALT.
45
    #[serde(rename = "alt")]
46
    pub alt: bool,
47
    /// Press CMD (Mac).
48
    #[serde(rename = "command")]
49
    pub command: bool,
50
}