Coverage Report

Created: 2022-07-04 16:17

src/requests/general.rs
Line
Count
Source (jump to first uncovered line)
1
//! General requests, not fitting into any category.
2
3
use serde::Serialize;
4
5
22
#[derive(
S21
eri
aliz1
e)]
Unexecuted instantiation: <obws::requests::general::Request as serde::ser::Serialize>::serialize::<&mut serde_json::ser::Serializer<&mut alloc::vec::Vec<u8>>>
<obws::requests::general::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
21
#[derive(Serialize)]
<<obws::requests::general::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::general::Request as serde::ser::Serialize>::serialize::__AdjacentlyTagged as serde::ser::Serialize>::serialize::<_>
Unexecuted instantiation: <obws::requests::general::Request as serde::ser::Serialize>::serialize::<_>
Unexecuted instantiation: <obws::requests::general::Request as serde::ser::Serialize>::serialize::<_>
Unexecuted instantiation: <<obws::requests::general::Request as serde::ser::Serialize>::serialize::__AdjacentlyTagged as serde::ser::Serialize>::serialize::<_>
6
#[serde(tag = "requestType", content = "requestData")]
7
pub(crate) enum Request<'a> {
8
    #[serde(rename = "GetVersion")]
9
    Version,
10
    #[serde(rename = "GetStats")]
11
    Stats,
12
    #[serde(rename = "BroadcastCustomEvent")]
13
    BroadcastCustomEvent {
14
        /// Data payload to emit to all receivers.
15
        #[serde(rename = "eventData")]
16
        event_data: serde_json::Value,
17
    },
18
    #[serde(rename = "CallVendorRequest")]
19
    CallVendorRequest(CallVendorRequestInternal<'a>),
20
    // TODO: Sleep
21
}
22
23
impl<'a> From<Request<'a>> for super::RequestType<'a> {
24
21
    fn from(value: Request<'a>) -> Self {
25
21
        super::RequestType::General(value)
26
21
    }
<obws::requests::RequestType as core::convert::From<obws::requests::general::Request>>::from
Line
Count
Source
24
21
    fn from(value: Request<'a>) -> Self {
25
21
        super::RequestType::General(value)
26
21
    }
Unexecuted instantiation: <obws::requests::RequestType as core::convert::From<obws::requests::general::Request>>::from
27
}
28
29
/// Request information for [`crate::client::General::call_vendor_request`].
30
pub struct CallVendorRequest<'a, T> {
31
    /// Name of the vendor to use.
32
    pub vendor_name: &'a str,
33
    /// The request type to call.
34
    pub request_type: &'a str,
35
    /// Object containing appropriate request data.
36
    pub request_data: &'a T,
37
}
38
39
/// Request information for [`crate::client::General::call_vendor_request`].
40
0
#[derive(Default, Serialize)]
Unexecuted instantiation: <obws::requests::general::CallVendorRequestInternal as core::default::Default>::default
Unexecuted instantiation: <obws::requests::general::CallVendorRequestInternal as core::default::Default>::default
Unexecuted instantiation: <obws::requests::general::CallVendorRequestInternal as serde::ser::Serialize>::serialize::<&mut serde_json::ser::Serializer<&mut alloc::vec::Vec<u8>>>
Unexecuted instantiation: <obws::requests::general::CallVendorRequestInternal as serde::ser::Serialize>::serialize::<_>
Unexecuted instantiation: <obws::requests::general::CallVendorRequestInternal as serde::ser::Serialize>::serialize::<_>
41
pub(crate) struct CallVendorRequestInternal<'a> {
42
    /// Name of the vendor to use.
43
    #[serde(rename = "vendorName")]
44
    pub vendor_name: &'a str,
45
    /// The request type to call.
46
    #[serde(rename = "requestType")]
47
    pub request_type: &'a str,
48
    /// Object containing appropriate request data.
49
    #[serde(rename = "requestData")]
50
    pub request_data: serde_json::Value,
51
}