rust_tdlib/types/
get_log_stream.rs

1use crate::errors::Result;
2use crate::types::*;
3use uuid::Uuid;
4
5/// Returns information about currently used log stream for internal logging of TDLib. Can be called synchronously
6#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7pub struct GetLogStream {
8    #[doc(hidden)]
9    #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
10    extra: Option<String>,
11    #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
12    client_id: Option<i32>,
13
14    #[serde(rename(serialize = "@type"))]
15    td_type: String,
16}
17
18impl RObject for GetLogStream {
19    #[doc(hidden)]
20    fn extra(&self) -> Option<&str> {
21        self.extra.as_deref()
22    }
23    #[doc(hidden)]
24    fn client_id(&self) -> Option<i32> {
25        self.client_id
26    }
27}
28
29impl TDLogStream for GetLogStream {}
30
31impl RFunction for GetLogStream {}
32
33impl GetLogStream {
34    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
35        Ok(serde_json::from_str(json.as_ref())?)
36    }
37    pub fn builder() -> GetLogStreamBuilder {
38        let mut inner = GetLogStream::default();
39        inner.extra = Some(Uuid::new_v4().to_string());
40
41        inner.td_type = "getLogStream".to_string();
42
43        GetLogStreamBuilder { inner }
44    }
45}
46
47#[doc(hidden)]
48pub struct GetLogStreamBuilder {
49    inner: GetLogStream,
50}
51
52#[deprecated]
53pub type RTDGetLogStreamBuilder = GetLogStreamBuilder;
54
55impl GetLogStreamBuilder {
56    pub fn build(&self) -> GetLogStream {
57        self.inner.clone()
58    }
59}
60
61impl AsRef<GetLogStream> for GetLogStream {
62    fn as_ref(&self) -> &GetLogStream {
63        self
64    }
65}
66
67impl AsRef<GetLogStream> for GetLogStreamBuilder {
68    fn as_ref(&self) -> &GetLogStream {
69        &self.inner
70    }
71}