Coverage Report

Created: 2022-07-04 16:17

src/client/streaming.rs
Line
Count
Source (jump to first uncovered line)
1
use super::Client;
2
use crate::{requests::streaming::Request, responses::streaming as responses, Result};
3
4
/// API functions related to streaming.
5
pub struct Streaming<'a> {
6
    pub(super) client: &'a Client,
7
}
8
9
impl<'a> Streaming<'a> {
10
    /// Gets the status of the stream output.
11
1
    pub async fn status(&self) -> Result<responses::StreamStatus> {
<obws::client::streaming::Streaming>::status
Line
Count
Source
11
1
    pub async fn status(&self) -> Result<responses::StreamStatus> {
Unexecuted instantiation: <obws::client::streaming::Streaming>::status
12
2
        
self.client.send_message(Request::GetStreamStatus)1
.await
13
1
    }
<obws::client::streaming::Streaming>::status::{closure#0}
Line
Count
Source
12
2
        
self.client.send_message(Request::GetStreamStatus)1
.await
13
1
    }
Unexecuted instantiation: <obws::client::streaming::Streaming>::status::{closure#0}
Unexecuted instantiation: <obws::client::streaming::Streaming>::status::{closure#0}
14
15
    /// Toggles the status of the stream output.
16
0
    pub async fn toggle(&self) -> Result<bool> {
Unexecuted instantiation: <obws::client::streaming::Streaming>::toggle
Unexecuted instantiation: <obws::client::streaming::Streaming>::toggle
17
0
        self.client
18
0
            .send_message::<_, responses::OutputActive>(Request::ToggleStream)
19
0
            .await
20
0
            .map(|ts| ts.active)
Unexecuted instantiation: <obws::client::streaming::Streaming>::toggle::{closure#0}::{closure#0}
Unexecuted instantiation: <obws::client::streaming::Streaming>::toggle::{closure#0}::{closure#0}
21
0
    }
Unexecuted instantiation: <obws::client::streaming::Streaming>::toggle::{closure#0}
Unexecuted instantiation: <obws::client::streaming::Streaming>::toggle::{closure#0}
22
23
    /// Starts the stream output.
24
0
    pub async fn start(&self) -> Result<()> {
Unexecuted instantiation: <obws::client::streaming::Streaming>::start
Unexecuted instantiation: <obws::client::streaming::Streaming>::start
25
0
        self.client.send_message(Request::StartStream).await
26
0
    }
Unexecuted instantiation: <obws::client::streaming::Streaming>::start::{closure#0}
Unexecuted instantiation: <obws::client::streaming::Streaming>::start::{closure#0}
27
28
    /// Stops the stream output.
29
0
    pub async fn stop(&self) -> Result<()> {
Unexecuted instantiation: <obws::client::streaming::Streaming>::stop
Unexecuted instantiation: <obws::client::streaming::Streaming>::stop
30
0
        self.client.send_message(Request::StopStream).await
31
0
    }
Unexecuted instantiation: <obws::client::streaming::Streaming>::stop::{closure#0}
Unexecuted instantiation: <obws::client::streaming::Streaming>::stop::{closure#0}
32
33
    /// Sends CEA-608 caption text over the stream output.
34
0
    pub async fn send_caption(&self, caption_text: &str) -> Result<()> {
Unexecuted instantiation: <obws::client::streaming::Streaming>::send_caption
Unexecuted instantiation: <obws::client::streaming::Streaming>::send_caption
35
0
        self.client
36
0
            .send_message(Request::SendStreamCaption { caption_text })
37
0
            .await
38
0
    }
Unexecuted instantiation: <obws::client::streaming::Streaming>::send_caption::{closure#0}
Unexecuted instantiation: <obws::client::streaming::Streaming>::send_caption::{closure#0}
39
}