Line | Count | Source (jump to first uncovered line) |
1 | | //! Requests related to sources. |
2 | | |
3 | | use std::path::Path; |
4 | | |
5 | | use serde::Serialize; |
6 | | use serde_with::skip_serializing_none; |
7 | | |
8 | 4 | #[derive(S3 erializ1 e)] Unexecuted instantiation: <obws::requests::sources::Request as serde::ser::Serialize>::serialize::<&mut serde_json::ser::Serializer<&mut alloc::vec::Vec<u8>>> <obws::requests::sources::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 | 8 | 3 | #[derive(Serialize)] |
<<obws::requests::sources::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 | 8 | 1 | #[derive(Serialize)] |
Unexecuted instantiation: <obws::requests::sources::Request as serde::ser::Serialize>::serialize::<_> Unexecuted instantiation: <<obws::requests::sources::Request as serde::ser::Serialize>::serialize::__AdjacentlyTagged as serde::ser::Serialize>::serialize::<_> Unexecuted instantiation: <<obws::requests::sources::Request as serde::ser::Serialize>::serialize::__AdjacentlyTagged as serde::ser::Serialize>::serialize::<_> Unexecuted instantiation: <obws::requests::sources::Request as serde::ser::Serialize>::serialize::<_> |
9 | | #[serde(tag = "requestType", content = "requestData")] |
10 | | pub(crate) enum Request<'a> { |
11 | | #[serde(rename = "GetSourceActive")] |
12 | | Active { |
13 | | /// Name of the source to get the active state of. |
14 | | #[serde(rename = "sourceName")] |
15 | | name: &'a str, |
16 | | }, |
17 | | #[serde(rename = "GetSourceScreenshot")] |
18 | | TakeScreenshot(TakeScreenshot<'a>), |
19 | | #[serde(rename = "SaveSourceScreenshot")] |
20 | | SaveScreenshot(SaveScreenshot<'a>), |
21 | | } |
22 | | |
23 | | impl<'a> From<Request<'a>> for super::RequestType<'a> { |
24 | 3 | fn from(value: Request<'a>) -> Self { |
25 | 3 | super::RequestType::Sources(value) |
26 | 3 | } <obws::requests::RequestType as core::convert::From<obws::requests::sources::Request>>::from Line | Count | Source | 24 | 3 | fn from(value: Request<'a>) -> Self { | 25 | 3 | super::RequestType::Sources(value) | 26 | 3 | } |
Unexecuted instantiation: <obws::requests::RequestType as core::convert::From<obws::requests::sources::Request>>::from |
27 | | } |
28 | | |
29 | | /// Request information for [`crate::client::Sources::take_screenshot`]. |
30 | | #[skip_serializing_none] |
31 | 1 | #[derive(Default0 , Serialize)] Unexecuted instantiation: <obws::requests::sources::TakeScreenshot as core::default::Default>::default Unexecuted instantiation: <obws::requests::sources::TakeScreenshot as core::default::Default>::default <obws::requests::sources::TakeScreenshot as serde::ser::Serialize>::serialize::<&mut serde_json::ser::Serializer<&mut alloc::vec::Vec<u8>>> Line | Count | Source | 31 | 1 | #[derive(Default, Serialize)] |
Unexecuted instantiation: <obws::requests::sources::TakeScreenshot as serde::ser::Serialize>::serialize::<_> Unexecuted instantiation: <obws::requests::sources::TakeScreenshot as serde::ser::Serialize>::serialize::<_> |
32 | | pub struct TakeScreenshot<'a> { |
33 | | /// Name of the source to take a screenshot of. |
34 | | #[serde(rename = "sourceName")] |
35 | | pub source: &'a str, |
36 | | /// Image compression format to use. Use [`crate::client::General::version`] to get compatible |
37 | | /// image formats. |
38 | | #[serde(rename = "imageFormat")] |
39 | | pub format: &'a str, |
40 | | /// Width to scale the screenshot to. |
41 | | #[serde(rename = "imageWidth")] |
42 | | pub width: Option<u32>, |
43 | | /// Height to scale the screenshot to. |
44 | | #[serde(rename = "imageHeight")] |
45 | | pub height: Option<u32>, |
46 | | /// Compression quality to use. 0 for high compression, 100 for uncompressed. -1 to use |
47 | | /// "default". |
48 | | #[serde(rename = "imageCompressionQuality")] |
49 | | pub compression_quality: Option<i32>, |
50 | | } |
51 | | |
52 | | /// Request information for [`crate::client::Sources::save_screenshot`]. |
53 | | #[skip_serializing_none] |
54 | 1 | #[derive(Serialize)] <obws::requests::sources::SaveScreenshot as serde::ser::Serialize>::serialize::<&mut serde_json::ser::Serializer<&mut alloc::vec::Vec<u8>>> Line | Count | Source | 54 | 1 | #[derive(Serialize)] |
Unexecuted instantiation: <obws::requests::sources::SaveScreenshot as serde::ser::Serialize>::serialize::<_> Unexecuted instantiation: <obws::requests::sources::SaveScreenshot as serde::ser::Serialize>::serialize::<_> |
55 | | pub struct SaveScreenshot<'a> { |
56 | | /// Name of the source to take a screenshot of. |
57 | | #[serde(rename = "sourceName")] |
58 | | pub source: &'a str, |
59 | | /// Image compression format to use. Use [`crate::client::General::version`] to get compatible |
60 | | /// image formats. |
61 | | #[serde(rename = "imageFormat")] |
62 | | pub format: &'a str, |
63 | | /// Width to scale the screenshot to. |
64 | | #[serde(rename = "imageWidth")] |
65 | | pub width: Option<u32>, |
66 | | /// Height to scale the screenshot to. |
67 | | #[serde(rename = "imageHeight")] |
68 | | pub height: Option<u32>, |
69 | | /// Compression quality to use. 0 for high compression, 100 for uncompressed. -1 to use |
70 | | /// "default". |
71 | | #[serde(rename = "imageCompressionQuality")] |
72 | | pub compression_quality: Option<i32>, |
73 | | /// Path to save the screenshot file to. For example `C:\Users\user\Desktop\screenshot.png`. |
74 | | #[serde(rename = "imageFilePath")] |
75 | | pub file_path: &'a Path, |
76 | | } |