rtdlib/types/
_common.rs

1use std::fmt::Debug;
2
3use serde::de::{Deserialize, Deserializer};
4
5use crate::errors::*;
6use crate::types::*;
7
8macro_rules! rtd_enum_deserialize {
9  ($type_name:ident, $(($td_name:ident, $enum_item:ident));*;) => {
10    // example json
11    // {"@type":"authorizationStateWaitEncryptionKey","is_encrypted":false}
12    |deserializer: D| -> Result<$type_name, D::Error> {
13      let rtd_trait_value: serde_json::Value = Deserialize::deserialize(deserializer)?;
14      // the `rtd_trait_value` variable type is &serde_json::Value, tdlib trait will return a object, convert this type to object `&Map<String, Value>`
15      let rtd_trait_map = match rtd_trait_value.as_object() {
16        Some(map) => map,
17        None => return Err(
18          D::Error::custom(format!(
19            "{} is not the correct type", stringify!($type_name)
20          ))
21        ) // &format!("{} is not the correct type", stringify!($field))[..]
22      };
23      // get `@type` value, detect specific types
24      let rtd_trait_type = match rtd_trait_map.get("@type") {
25        // the `t` variable type is `serde_json::Value`, convert `t` to str
26        Some(t) => match t.as_str() {
27          Some(s) => s,
28          None => return Err(
29            D::Error::custom(format!(
30              "{} -> @type is not the correct type", stringify!($type_name)
31            ))
32          ) // &format!("{} -> @type is not the correct type", stringify!($field))[..]
33        },
34        None => return Err(D::Error::custom(format!("unknown field {} -> @type", stringify!($type_name))))
35      };
36
37      let obj = match rtd_trait_type {
38        $(
39          stringify!($td_name) => $type_name::$enum_item(match serde_json::from_value(rtd_trait_value.clone()) {
40            Ok(t) => t,
41            Err(_e) => return Err(
42              D::Error::custom(format!(
43                "{} can't deserialize to {}::{}; {:?}",
44                stringify!($td_name),
45                stringify!($type_name),
46                stringify!($enum_item),
47                _e,
48              ))
49            )
50          }),
51        )*
52        _ => return Err(D::Error::custom(format!("missing field {}", rtd_trait_type)))
53      };
54      Ok(obj)
55    }
56  }
57}
58
59
60///// tuple enum is field
61//macro_rules! tuple_enum_is {
62//  ($enum_name:ident, $field:ident) => {
63//    |o: &$enum_name| {
64//      if let $enum_name::$field(_) = o { true } else { false }
65//    }
66//  };
67////  ($e:ident, $t:ident, $namespace:ident) => {
68////    Box::new(|t: &$e| {
69////      match t {
70////        $namespace::$e::$t(_) => true,
71////        _ => false
72////      }
73////    })
74////  };
75//}
76//
77//macro_rules! tuple_enum_on {
78//  ($enum_name:ident, $field:ident, $fnc:expr) => {
79//    |o: &$enum_name| {
80//      if let $enum_name::$field(t) = o { $fnc(t) }
81//    }
82//  };
83//}
84
85pub fn detect_td_type<S: AsRef<str>>(json: S) -> Option<String> {
86  let result: Result<serde_json::Value, serde_json::Error> = serde_json::from_str::<serde_json::Value>(json.as_ref());
87  if let Err(_) = result { return None }
88  let value = result.unwrap();
89  value.as_object().map_or(None, |v| {
90    v.get("@type").map_or(None, |t| t.as_str().map_or(None, |t| {
91      Some(t.to_string())
92    }))
93  })
94}
95
96pub fn detect_td_type_and_extra<S: AsRef<str>>(json: S) -> (Option<String>, Option<String>) {
97  let result: Result<serde_json::Value, serde_json::Error> = serde_json::from_str::<serde_json::Value>(json.as_ref());
98  if let Err(_) = result { return (None, None) }
99  let value = result.unwrap();
100  let mut type_ = None;
101  let mut extra = None;
102  if let Some(map) = value.as_object() {
103    map.get("@type").map(|v| v.as_str().map(|t| type_.replace(t.to_string())));
104    map.get("@extra").map(|v| v.as_str().map(|t| extra.replace(t.to_string())));
105  }
106  (type_, extra)
107}
108
109pub fn from_json<'a, T>(json: &'a str) -> RTDResult<T> where T: serde::de::Deserialize<'a>, {
110  Ok(serde_json::from_str(json.as_ref())?)
111}
112
113/// All tdlib type abstract class defined the same behavior
114pub trait RObject: Debug {
115  #[doc(hidden)]
116  fn td_name(&self) -> &'static str;
117  #[doc(hidden)]
118  fn extra(&self) -> Option<String>;
119  /// Return td type to json string
120  fn to_json(&self) -> RTDResult<String>;
121}
122
123pub trait RFunction: Debug + RObject {}
124
125
126impl<'a, RObj: RObject> RObject for &'a RObj {
127  fn td_name(&self) -> &'static str { (*self).td_name() }
128  fn to_json(&self) -> RTDResult<String> { (*self).to_json() }
129  fn extra(&self) -> Option<String> { (*self).extra() }
130}
131
132impl<'a, RObj: RObject> RObject for &'a mut RObj {
133  fn td_name(&self) -> &'static str { (**self).td_name() }
134  fn to_json(&self) -> RTDResult<String> { (**self).to_json() }
135  fn extra(&self) -> Option<String> { (**self).extra() }
136}
137
138
139impl<'a, Fnc: RFunction> RFunction for &'a Fnc {}
140impl<'a, Fnc: RFunction> RFunction for &'a mut Fnc {}
141
142
143impl<'a, AUTHENTICATIONCODETYPE: TDAuthenticationCodeType> TDAuthenticationCodeType for &'a AUTHENTICATIONCODETYPE {}
144impl<'a, AUTHENTICATIONCODETYPE: TDAuthenticationCodeType> TDAuthenticationCodeType for &'a mut AUTHENTICATIONCODETYPE {}
145
146impl<'a, AUTHORIZATIONSTATE: TDAuthorizationState> TDAuthorizationState for &'a AUTHORIZATIONSTATE {}
147impl<'a, AUTHORIZATIONSTATE: TDAuthorizationState> TDAuthorizationState for &'a mut AUTHORIZATIONSTATE {}
148
149impl<'a, BACKGROUNDFILL: TDBackgroundFill> TDBackgroundFill for &'a BACKGROUNDFILL {}
150impl<'a, BACKGROUNDFILL: TDBackgroundFill> TDBackgroundFill for &'a mut BACKGROUNDFILL {}
151
152impl<'a, BACKGROUNDTYPE: TDBackgroundType> TDBackgroundType for &'a BACKGROUNDTYPE {}
153impl<'a, BACKGROUNDTYPE: TDBackgroundType> TDBackgroundType for &'a mut BACKGROUNDTYPE {}
154
155impl<'a, BOTCOMMANDSCOPE: TDBotCommandScope> TDBotCommandScope for &'a BOTCOMMANDSCOPE {}
156impl<'a, BOTCOMMANDSCOPE: TDBotCommandScope> TDBotCommandScope for &'a mut BOTCOMMANDSCOPE {}
157
158impl<'a, CALLDISCARDREASON: TDCallDiscardReason> TDCallDiscardReason for &'a CALLDISCARDREASON {}
159impl<'a, CALLDISCARDREASON: TDCallDiscardReason> TDCallDiscardReason for &'a mut CALLDISCARDREASON {}
160
161impl<'a, CALLPROBLEM: TDCallProblem> TDCallProblem for &'a CALLPROBLEM {}
162impl<'a, CALLPROBLEM: TDCallProblem> TDCallProblem for &'a mut CALLPROBLEM {}
163
164impl<'a, CALLSERVERTYPE: TDCallServerType> TDCallServerType for &'a CALLSERVERTYPE {}
165impl<'a, CALLSERVERTYPE: TDCallServerType> TDCallServerType for &'a mut CALLSERVERTYPE {}
166
167impl<'a, CALLSTATE: TDCallState> TDCallState for &'a CALLSTATE {}
168impl<'a, CALLSTATE: TDCallState> TDCallState for &'a mut CALLSTATE {}
169
170impl<'a, CALLBACKQUERYPAYLOAD: TDCallbackQueryPayload> TDCallbackQueryPayload for &'a CALLBACKQUERYPAYLOAD {}
171impl<'a, CALLBACKQUERYPAYLOAD: TDCallbackQueryPayload> TDCallbackQueryPayload for &'a mut CALLBACKQUERYPAYLOAD {}
172
173impl<'a, CANTRANSFEROWNERSHIPRESULT: TDCanTransferOwnershipResult> TDCanTransferOwnershipResult for &'a CANTRANSFEROWNERSHIPRESULT {}
174impl<'a, CANTRANSFEROWNERSHIPRESULT: TDCanTransferOwnershipResult> TDCanTransferOwnershipResult for &'a mut CANTRANSFEROWNERSHIPRESULT {}
175
176impl<'a, CHATACTION: TDChatAction> TDChatAction for &'a CHATACTION {}
177impl<'a, CHATACTION: TDChatAction> TDChatAction for &'a mut CHATACTION {}
178
179impl<'a, CHATACTIONBAR: TDChatActionBar> TDChatActionBar for &'a CHATACTIONBAR {}
180impl<'a, CHATACTIONBAR: TDChatActionBar> TDChatActionBar for &'a mut CHATACTIONBAR {}
181
182impl<'a, CHATEVENTACTION: TDChatEventAction> TDChatEventAction for &'a CHATEVENTACTION {}
183impl<'a, CHATEVENTACTION: TDChatEventAction> TDChatEventAction for &'a mut CHATEVENTACTION {}
184
185impl<'a, CHATLIST: TDChatList> TDChatList for &'a CHATLIST {}
186impl<'a, CHATLIST: TDChatList> TDChatList for &'a mut CHATLIST {}
187
188impl<'a, CHATMEMBERSTATUS: TDChatMemberStatus> TDChatMemberStatus for &'a CHATMEMBERSTATUS {}
189impl<'a, CHATMEMBERSTATUS: TDChatMemberStatus> TDChatMemberStatus for &'a mut CHATMEMBERSTATUS {}
190
191impl<'a, CHATMEMBERSFILTER: TDChatMembersFilter> TDChatMembersFilter for &'a CHATMEMBERSFILTER {}
192impl<'a, CHATMEMBERSFILTER: TDChatMembersFilter> TDChatMembersFilter for &'a mut CHATMEMBERSFILTER {}
193
194impl<'a, CHATREPORTREASON: TDChatReportReason> TDChatReportReason for &'a CHATREPORTREASON {}
195impl<'a, CHATREPORTREASON: TDChatReportReason> TDChatReportReason for &'a mut CHATREPORTREASON {}
196
197impl<'a, CHATSOURCE: TDChatSource> TDChatSource for &'a CHATSOURCE {}
198impl<'a, CHATSOURCE: TDChatSource> TDChatSource for &'a mut CHATSOURCE {}
199
200impl<'a, CHATSTATISTICS: TDChatStatistics> TDChatStatistics for &'a CHATSTATISTICS {}
201impl<'a, CHATSTATISTICS: TDChatStatistics> TDChatStatistics for &'a mut CHATSTATISTICS {}
202
203impl<'a, CHATTYPE: TDChatType> TDChatType for &'a CHATTYPE {}
204impl<'a, CHATTYPE: TDChatType> TDChatType for &'a mut CHATTYPE {}
205
206impl<'a, CHECKCHATUSERNAMERESULT: TDCheckChatUsernameResult> TDCheckChatUsernameResult for &'a CHECKCHATUSERNAMERESULT {}
207impl<'a, CHECKCHATUSERNAMERESULT: TDCheckChatUsernameResult> TDCheckChatUsernameResult for &'a mut CHECKCHATUSERNAMERESULT {}
208
209impl<'a, CHECKSTICKERSETNAMERESULT: TDCheckStickerSetNameResult> TDCheckStickerSetNameResult for &'a CHECKSTICKERSETNAMERESULT {}
210impl<'a, CHECKSTICKERSETNAMERESULT: TDCheckStickerSetNameResult> TDCheckStickerSetNameResult for &'a mut CHECKSTICKERSETNAMERESULT {}
211
212impl<'a, CONNECTIONSTATE: TDConnectionState> TDConnectionState for &'a CONNECTIONSTATE {}
213impl<'a, CONNECTIONSTATE: TDConnectionState> TDConnectionState for &'a mut CONNECTIONSTATE {}
214
215impl<'a, DEVICETOKEN: TDDeviceToken> TDDeviceToken for &'a DEVICETOKEN {}
216impl<'a, DEVICETOKEN: TDDeviceToken> TDDeviceToken for &'a mut DEVICETOKEN {}
217
218impl<'a, DICESTICKERS: TDDiceStickers> TDDiceStickers for &'a DICESTICKERS {}
219impl<'a, DICESTICKERS: TDDiceStickers> TDDiceStickers for &'a mut DICESTICKERS {}
220
221impl<'a, FILETYPE: TDFileType> TDFileType for &'a FILETYPE {}
222impl<'a, FILETYPE: TDFileType> TDFileType for &'a mut FILETYPE {}
223
224impl<'a, GROUPCALLVIDEOQUALITY: TDGroupCallVideoQuality> TDGroupCallVideoQuality for &'a GROUPCALLVIDEOQUALITY {}
225impl<'a, GROUPCALLVIDEOQUALITY: TDGroupCallVideoQuality> TDGroupCallVideoQuality for &'a mut GROUPCALLVIDEOQUALITY {}
226
227impl<'a, INLINEKEYBOARDBUTTONTYPE: TDInlineKeyboardButtonType> TDInlineKeyboardButtonType for &'a INLINEKEYBOARDBUTTONTYPE {}
228impl<'a, INLINEKEYBOARDBUTTONTYPE: TDInlineKeyboardButtonType> TDInlineKeyboardButtonType for &'a mut INLINEKEYBOARDBUTTONTYPE {}
229
230impl<'a, INLINEQUERYRESULT: TDInlineQueryResult> TDInlineQueryResult for &'a INLINEQUERYRESULT {}
231impl<'a, INLINEQUERYRESULT: TDInlineQueryResult> TDInlineQueryResult for &'a mut INLINEQUERYRESULT {}
232
233impl<'a, INPUTBACKGROUND: TDInputBackground> TDInputBackground for &'a INPUTBACKGROUND {}
234impl<'a, INPUTBACKGROUND: TDInputBackground> TDInputBackground for &'a mut INPUTBACKGROUND {}
235
236impl<'a, INPUTCHATPHOTO: TDInputChatPhoto> TDInputChatPhoto for &'a INPUTCHATPHOTO {}
237impl<'a, INPUTCHATPHOTO: TDInputChatPhoto> TDInputChatPhoto for &'a mut INPUTCHATPHOTO {}
238
239impl<'a, INPUTCREDENTIALS: TDInputCredentials> TDInputCredentials for &'a INPUTCREDENTIALS {}
240impl<'a, INPUTCREDENTIALS: TDInputCredentials> TDInputCredentials for &'a mut INPUTCREDENTIALS {}
241
242impl<'a, INPUTFILE: TDInputFile> TDInputFile for &'a INPUTFILE {}
243impl<'a, INPUTFILE: TDInputFile> TDInputFile for &'a mut INPUTFILE {}
244
245impl<'a, INPUTINLINEQUERYRESULT: TDInputInlineQueryResult> TDInputInlineQueryResult for &'a INPUTINLINEQUERYRESULT {}
246impl<'a, INPUTINLINEQUERYRESULT: TDInputInlineQueryResult> TDInputInlineQueryResult for &'a mut INPUTINLINEQUERYRESULT {}
247
248impl<'a, INPUTMESSAGECONTENT: TDInputMessageContent> TDInputMessageContent for &'a INPUTMESSAGECONTENT {}
249impl<'a, INPUTMESSAGECONTENT: TDInputMessageContent> TDInputMessageContent for &'a mut INPUTMESSAGECONTENT {}
250
251impl<'a, INPUTPASSPORTELEMENT: TDInputPassportElement> TDInputPassportElement for &'a INPUTPASSPORTELEMENT {}
252impl<'a, INPUTPASSPORTELEMENT: TDInputPassportElement> TDInputPassportElement for &'a mut INPUTPASSPORTELEMENT {}
253
254impl<'a, INPUTPASSPORTELEMENTERRORSOURCE: TDInputPassportElementErrorSource> TDInputPassportElementErrorSource for &'a INPUTPASSPORTELEMENTERRORSOURCE {}
255impl<'a, INPUTPASSPORTELEMENTERRORSOURCE: TDInputPassportElementErrorSource> TDInputPassportElementErrorSource for &'a mut INPUTPASSPORTELEMENTERRORSOURCE {}
256
257impl<'a, INPUTSTICKER: TDInputSticker> TDInputSticker for &'a INPUTSTICKER {}
258impl<'a, INPUTSTICKER: TDInputSticker> TDInputSticker for &'a mut INPUTSTICKER {}
259
260impl<'a, INTERNALLINKTYPE: TDInternalLinkType> TDInternalLinkType for &'a INTERNALLINKTYPE {}
261impl<'a, INTERNALLINKTYPE: TDInternalLinkType> TDInternalLinkType for &'a mut INTERNALLINKTYPE {}
262
263impl<'a, JSONVALUE: TDJsonValue> TDJsonValue for &'a JSONVALUE {}
264impl<'a, JSONVALUE: TDJsonValue> TDJsonValue for &'a mut JSONVALUE {}
265
266impl<'a, KEYBOARDBUTTONTYPE: TDKeyboardButtonType> TDKeyboardButtonType for &'a KEYBOARDBUTTONTYPE {}
267impl<'a, KEYBOARDBUTTONTYPE: TDKeyboardButtonType> TDKeyboardButtonType for &'a mut KEYBOARDBUTTONTYPE {}
268
269impl<'a, LANGUAGEPACKSTRINGVALUE: TDLanguagePackStringValue> TDLanguagePackStringValue for &'a LANGUAGEPACKSTRINGVALUE {}
270impl<'a, LANGUAGEPACKSTRINGVALUE: TDLanguagePackStringValue> TDLanguagePackStringValue for &'a mut LANGUAGEPACKSTRINGVALUE {}
271
272impl<'a, LOGSTREAM: TDLogStream> TDLogStream for &'a LOGSTREAM {}
273impl<'a, LOGSTREAM: TDLogStream> TDLogStream for &'a mut LOGSTREAM {}
274
275impl<'a, LOGINURLINFO: TDLoginUrlInfo> TDLoginUrlInfo for &'a LOGINURLINFO {}
276impl<'a, LOGINURLINFO: TDLoginUrlInfo> TDLoginUrlInfo for &'a mut LOGINURLINFO {}
277
278impl<'a, MASKPOINT: TDMaskPoint> TDMaskPoint for &'a MASKPOINT {}
279impl<'a, MASKPOINT: TDMaskPoint> TDMaskPoint for &'a mut MASKPOINT {}
280
281impl<'a, MESSAGECONTENT: TDMessageContent> TDMessageContent for &'a MESSAGECONTENT {}
282impl<'a, MESSAGECONTENT: TDMessageContent> TDMessageContent for &'a mut MESSAGECONTENT {}
283
284impl<'a, MESSAGEFILETYPE: TDMessageFileType> TDMessageFileType for &'a MESSAGEFILETYPE {}
285impl<'a, MESSAGEFILETYPE: TDMessageFileType> TDMessageFileType for &'a mut MESSAGEFILETYPE {}
286
287impl<'a, MESSAGEFORWARDORIGIN: TDMessageForwardOrigin> TDMessageForwardOrigin for &'a MESSAGEFORWARDORIGIN {}
288impl<'a, MESSAGEFORWARDORIGIN: TDMessageForwardOrigin> TDMessageForwardOrigin for &'a mut MESSAGEFORWARDORIGIN {}
289
290impl<'a, MESSAGESCHEDULINGSTATE: TDMessageSchedulingState> TDMessageSchedulingState for &'a MESSAGESCHEDULINGSTATE {}
291impl<'a, MESSAGESCHEDULINGSTATE: TDMessageSchedulingState> TDMessageSchedulingState for &'a mut MESSAGESCHEDULINGSTATE {}
292
293impl<'a, MESSAGESENDER: TDMessageSender> TDMessageSender for &'a MESSAGESENDER {}
294impl<'a, MESSAGESENDER: TDMessageSender> TDMessageSender for &'a mut MESSAGESENDER {}
295
296impl<'a, MESSAGESENDINGSTATE: TDMessageSendingState> TDMessageSendingState for &'a MESSAGESENDINGSTATE {}
297impl<'a, MESSAGESENDINGSTATE: TDMessageSendingState> TDMessageSendingState for &'a mut MESSAGESENDINGSTATE {}
298
299impl<'a, NETWORKSTATISTICSENTRY: TDNetworkStatisticsEntry> TDNetworkStatisticsEntry for &'a NETWORKSTATISTICSENTRY {}
300impl<'a, NETWORKSTATISTICSENTRY: TDNetworkStatisticsEntry> TDNetworkStatisticsEntry for &'a mut NETWORKSTATISTICSENTRY {}
301
302impl<'a, NETWORKTYPE: TDNetworkType> TDNetworkType for &'a NETWORKTYPE {}
303impl<'a, NETWORKTYPE: TDNetworkType> TDNetworkType for &'a mut NETWORKTYPE {}
304
305impl<'a, NOTIFICATIONGROUPTYPE: TDNotificationGroupType> TDNotificationGroupType for &'a NOTIFICATIONGROUPTYPE {}
306impl<'a, NOTIFICATIONGROUPTYPE: TDNotificationGroupType> TDNotificationGroupType for &'a mut NOTIFICATIONGROUPTYPE {}
307
308impl<'a, NOTIFICATIONSETTINGSSCOPE: TDNotificationSettingsScope> TDNotificationSettingsScope for &'a NOTIFICATIONSETTINGSSCOPE {}
309impl<'a, NOTIFICATIONSETTINGSSCOPE: TDNotificationSettingsScope> TDNotificationSettingsScope for &'a mut NOTIFICATIONSETTINGSSCOPE {}
310
311impl<'a, NOTIFICATIONTYPE: TDNotificationType> TDNotificationType for &'a NOTIFICATIONTYPE {}
312impl<'a, NOTIFICATIONTYPE: TDNotificationType> TDNotificationType for &'a mut NOTIFICATIONTYPE {}
313
314impl<'a, OPTIONVALUE: TDOptionValue> TDOptionValue for &'a OPTIONVALUE {}
315impl<'a, OPTIONVALUE: TDOptionValue> TDOptionValue for &'a mut OPTIONVALUE {}
316
317impl<'a, PAGEBLOCK: TDPageBlock> TDPageBlock for &'a PAGEBLOCK {}
318impl<'a, PAGEBLOCK: TDPageBlock> TDPageBlock for &'a mut PAGEBLOCK {}
319
320impl<'a, PAGEBLOCKHORIZONTALALIGNMENT: TDPageBlockHorizontalAlignment> TDPageBlockHorizontalAlignment for &'a PAGEBLOCKHORIZONTALALIGNMENT {}
321impl<'a, PAGEBLOCKHORIZONTALALIGNMENT: TDPageBlockHorizontalAlignment> TDPageBlockHorizontalAlignment for &'a mut PAGEBLOCKHORIZONTALALIGNMENT {}
322
323impl<'a, PAGEBLOCKVERTICALALIGNMENT: TDPageBlockVerticalAlignment> TDPageBlockVerticalAlignment for &'a PAGEBLOCKVERTICALALIGNMENT {}
324impl<'a, PAGEBLOCKVERTICALALIGNMENT: TDPageBlockVerticalAlignment> TDPageBlockVerticalAlignment for &'a mut PAGEBLOCKVERTICALALIGNMENT {}
325
326impl<'a, PASSPORTELEMENT: TDPassportElement> TDPassportElement for &'a PASSPORTELEMENT {}
327impl<'a, PASSPORTELEMENT: TDPassportElement> TDPassportElement for &'a mut PASSPORTELEMENT {}
328
329impl<'a, PASSPORTELEMENTERRORSOURCE: TDPassportElementErrorSource> TDPassportElementErrorSource for &'a PASSPORTELEMENTERRORSOURCE {}
330impl<'a, PASSPORTELEMENTERRORSOURCE: TDPassportElementErrorSource> TDPassportElementErrorSource for &'a mut PASSPORTELEMENTERRORSOURCE {}
331
332impl<'a, PASSPORTELEMENTTYPE: TDPassportElementType> TDPassportElementType for &'a PASSPORTELEMENTTYPE {}
333impl<'a, PASSPORTELEMENTTYPE: TDPassportElementType> TDPassportElementType for &'a mut PASSPORTELEMENTTYPE {}
334
335impl<'a, POLLTYPE: TDPollType> TDPollType for &'a POLLTYPE {}
336impl<'a, POLLTYPE: TDPollType> TDPollType for &'a mut POLLTYPE {}
337
338impl<'a, PROXYTYPE: TDProxyType> TDProxyType for &'a PROXYTYPE {}
339impl<'a, PROXYTYPE: TDProxyType> TDProxyType for &'a mut PROXYTYPE {}
340
341impl<'a, PUBLICCHATTYPE: TDPublicChatType> TDPublicChatType for &'a PUBLICCHATTYPE {}
342impl<'a, PUBLICCHATTYPE: TDPublicChatType> TDPublicChatType for &'a mut PUBLICCHATTYPE {}
343
344impl<'a, PUSHMESSAGECONTENT: TDPushMessageContent> TDPushMessageContent for &'a PUSHMESSAGECONTENT {}
345impl<'a, PUSHMESSAGECONTENT: TDPushMessageContent> TDPushMessageContent for &'a mut PUSHMESSAGECONTENT {}
346
347impl<'a, REPLYMARKUP: TDReplyMarkup> TDReplyMarkup for &'a REPLYMARKUP {}
348impl<'a, REPLYMARKUP: TDReplyMarkup> TDReplyMarkup for &'a mut REPLYMARKUP {}
349
350impl<'a, RESETPASSWORDRESULT: TDResetPasswordResult> TDResetPasswordResult for &'a RESETPASSWORDRESULT {}
351impl<'a, RESETPASSWORDRESULT: TDResetPasswordResult> TDResetPasswordResult for &'a mut RESETPASSWORDRESULT {}
352
353impl<'a, RICHTEXT: TDRichText> TDRichText for &'a RICHTEXT {}
354impl<'a, RICHTEXT: TDRichText> TDRichText for &'a mut RICHTEXT {}
355
356impl<'a, SEARCHMESSAGESFILTER: TDSearchMessagesFilter> TDSearchMessagesFilter for &'a SEARCHMESSAGESFILTER {}
357impl<'a, SEARCHMESSAGESFILTER: TDSearchMessagesFilter> TDSearchMessagesFilter for &'a mut SEARCHMESSAGESFILTER {}
358
359impl<'a, SECRETCHATSTATE: TDSecretChatState> TDSecretChatState for &'a SECRETCHATSTATE {}
360impl<'a, SECRETCHATSTATE: TDSecretChatState> TDSecretChatState for &'a mut SECRETCHATSTATE {}
361
362impl<'a, STATISTICALGRAPH: TDStatisticalGraph> TDStatisticalGraph for &'a STATISTICALGRAPH {}
363impl<'a, STATISTICALGRAPH: TDStatisticalGraph> TDStatisticalGraph for &'a mut STATISTICALGRAPH {}
364
365impl<'a, SUGGESTEDACTION: TDSuggestedAction> TDSuggestedAction for &'a SUGGESTEDACTION {}
366impl<'a, SUGGESTEDACTION: TDSuggestedAction> TDSuggestedAction for &'a mut SUGGESTEDACTION {}
367
368impl<'a, SUPERGROUPMEMBERSFILTER: TDSupergroupMembersFilter> TDSupergroupMembersFilter for &'a SUPERGROUPMEMBERSFILTER {}
369impl<'a, SUPERGROUPMEMBERSFILTER: TDSupergroupMembersFilter> TDSupergroupMembersFilter for &'a mut SUPERGROUPMEMBERSFILTER {}
370
371impl<'a, TMEURLTYPE: TDTMeUrlType> TDTMeUrlType for &'a TMEURLTYPE {}
372impl<'a, TMEURLTYPE: TDTMeUrlType> TDTMeUrlType for &'a mut TMEURLTYPE {}
373
374impl<'a, TEXTENTITYTYPE: TDTextEntityType> TDTextEntityType for &'a TEXTENTITYTYPE {}
375impl<'a, TEXTENTITYTYPE: TDTextEntityType> TDTextEntityType for &'a mut TEXTENTITYTYPE {}
376
377impl<'a, TEXTPARSEMODE: TDTextParseMode> TDTextParseMode for &'a TEXTPARSEMODE {}
378impl<'a, TEXTPARSEMODE: TDTextParseMode> TDTextParseMode for &'a mut TEXTPARSEMODE {}
379
380impl<'a, THUMBNAILFORMAT: TDThumbnailFormat> TDThumbnailFormat for &'a THUMBNAILFORMAT {}
381impl<'a, THUMBNAILFORMAT: TDThumbnailFormat> TDThumbnailFormat for &'a mut THUMBNAILFORMAT {}
382
383impl<'a, TOPCHATCATEGORY: TDTopChatCategory> TDTopChatCategory for &'a TOPCHATCATEGORY {}
384impl<'a, TOPCHATCATEGORY: TDTopChatCategory> TDTopChatCategory for &'a mut TOPCHATCATEGORY {}
385
386impl<'a, UPDATE: TDUpdate> TDUpdate for &'a UPDATE {}
387impl<'a, UPDATE: TDUpdate> TDUpdate for &'a mut UPDATE {}
388
389impl<'a, USERPRIVACYSETTING: TDUserPrivacySetting> TDUserPrivacySetting for &'a USERPRIVACYSETTING {}
390impl<'a, USERPRIVACYSETTING: TDUserPrivacySetting> TDUserPrivacySetting for &'a mut USERPRIVACYSETTING {}
391
392impl<'a, USERPRIVACYSETTINGRULE: TDUserPrivacySettingRule> TDUserPrivacySettingRule for &'a USERPRIVACYSETTINGRULE {}
393impl<'a, USERPRIVACYSETTINGRULE: TDUserPrivacySettingRule> TDUserPrivacySettingRule for &'a mut USERPRIVACYSETTINGRULE {}
394
395impl<'a, USERSTATUS: TDUserStatus> TDUserStatus for &'a USERSTATUS {}
396impl<'a, USERSTATUS: TDUserStatus> TDUserStatus for &'a mut USERSTATUS {}
397
398impl<'a, USERTYPE: TDUserType> TDUserType for &'a USERTYPE {}
399impl<'a, USERTYPE: TDUserType> TDUserType for &'a mut USERTYPE {}
400
401impl<'a, VECTORPATHCOMMAND: TDVectorPathCommand> TDVectorPathCommand for &'a VECTORPATHCOMMAND {}
402impl<'a, VECTORPATHCOMMAND: TDVectorPathCommand> TDVectorPathCommand for &'a mut VECTORPATHCOMMAND {}
403
404
405#[derive(Debug, Clone)]
406pub enum TdType {
407  TestUseUpdate(TestUseUpdate),
408  UpdateActiveNotifications(UpdateActiveNotifications),
409  UpdateAnimatedEmojiMessageClicked(UpdateAnimatedEmojiMessageClicked),
410  UpdateAnimationSearchParameters(UpdateAnimationSearchParameters),
411  UpdateAuthorizationState(UpdateAuthorizationState),
412  UpdateBasicGroup(UpdateBasicGroup),
413  UpdateBasicGroupFullInfo(UpdateBasicGroupFullInfo),
414  UpdateCall(UpdateCall),
415  UpdateChatAction(UpdateChatAction),
416  UpdateChatActionBar(UpdateChatActionBar),
417  UpdateChatDefaultDisableNotification(UpdateChatDefaultDisableNotification),
418  UpdateChatDraftMessage(UpdateChatDraftMessage),
419  UpdateChatFilters(UpdateChatFilters),
420  UpdateChatHasProtectedContent(UpdateChatHasProtectedContent),
421  UpdateChatHasScheduledMessages(UpdateChatHasScheduledMessages),
422  UpdateChatIsBlocked(UpdateChatIsBlocked),
423  UpdateChatIsMarkedAsUnread(UpdateChatIsMarkedAsUnread),
424  UpdateChatLastMessage(UpdateChatLastMessage),
425  UpdateChatMember(UpdateChatMember),
426  UpdateChatMessageSender(UpdateChatMessageSender),
427  UpdateChatMessageTtl(UpdateChatMessageTtl),
428  UpdateChatNotificationSettings(UpdateChatNotificationSettings),
429  UpdateChatOnlineMemberCount(UpdateChatOnlineMemberCount),
430  UpdateChatPendingJoinRequests(UpdateChatPendingJoinRequests),
431  UpdateChatPermissions(UpdateChatPermissions),
432  UpdateChatPhoto(UpdateChatPhoto),
433  UpdateChatPosition(UpdateChatPosition),
434  UpdateChatReadInbox(UpdateChatReadInbox),
435  UpdateChatReadOutbox(UpdateChatReadOutbox),
436  UpdateChatReplyMarkup(UpdateChatReplyMarkup),
437  UpdateChatTheme(UpdateChatTheme),
438  UpdateChatThemes(UpdateChatThemes),
439  UpdateChatTitle(UpdateChatTitle),
440  UpdateChatUnreadMentionCount(UpdateChatUnreadMentionCount),
441  UpdateChatVideoChat(UpdateChatVideoChat),
442  UpdateConnectionState(UpdateConnectionState),
443  UpdateDeleteMessages(UpdateDeleteMessages),
444  UpdateDiceEmojis(UpdateDiceEmojis),
445  UpdateFavoriteStickers(UpdateFavoriteStickers),
446  UpdateFile(UpdateFile),
447  UpdateFileGenerationStart(UpdateFileGenerationStart),
448  UpdateFileGenerationStop(UpdateFileGenerationStop),
449  UpdateGroupCall(UpdateGroupCall),
450  UpdateGroupCallParticipant(UpdateGroupCallParticipant),
451  UpdateHavePendingNotifications(UpdateHavePendingNotifications),
452  UpdateInstalledStickerSets(UpdateInstalledStickerSets),
453  UpdateLanguagePackStrings(UpdateLanguagePackStrings),
454  UpdateMessageContent(UpdateMessageContent),
455  UpdateMessageContentOpened(UpdateMessageContentOpened),
456  UpdateMessageEdited(UpdateMessageEdited),
457  UpdateMessageInteractionInfo(UpdateMessageInteractionInfo),
458  UpdateMessageIsPinned(UpdateMessageIsPinned),
459  UpdateMessageLiveLocationViewed(UpdateMessageLiveLocationViewed),
460  UpdateMessageMentionRead(UpdateMessageMentionRead),
461  UpdateMessageSendAcknowledged(UpdateMessageSendAcknowledged),
462  UpdateMessageSendFailed(UpdateMessageSendFailed),
463  UpdateMessageSendSucceeded(UpdateMessageSendSucceeded),
464  UpdateNewCallSignalingData(UpdateNewCallSignalingData),
465  UpdateNewCallbackQuery(UpdateNewCallbackQuery),
466  UpdateNewChat(UpdateNewChat),
467  UpdateNewChatJoinRequest(UpdateNewChatJoinRequest),
468  UpdateNewChosenInlineResult(UpdateNewChosenInlineResult),
469  UpdateNewCustomEvent(UpdateNewCustomEvent),
470  UpdateNewCustomQuery(UpdateNewCustomQuery),
471  UpdateNewInlineCallbackQuery(UpdateNewInlineCallbackQuery),
472  UpdateNewInlineQuery(UpdateNewInlineQuery),
473  UpdateNewMessage(UpdateNewMessage),
474  UpdateNewPreCheckoutQuery(UpdateNewPreCheckoutQuery),
475  UpdateNewShippingQuery(UpdateNewShippingQuery),
476  UpdateNotification(UpdateNotification),
477  UpdateNotificationGroup(UpdateNotificationGroup),
478  UpdateOption(UpdateOption),
479  UpdatePoll(UpdatePoll),
480  UpdatePollAnswer(UpdatePollAnswer),
481  UpdateRecentStickers(UpdateRecentStickers),
482  UpdateSavedAnimations(UpdateSavedAnimations),
483  UpdateScopeNotificationSettings(UpdateScopeNotificationSettings),
484  UpdateSecretChat(UpdateSecretChat),
485  UpdateSelectedBackground(UpdateSelectedBackground),
486  UpdateServiceNotification(UpdateServiceNotification),
487  UpdateStickerSet(UpdateStickerSet),
488  UpdateSuggestedActions(UpdateSuggestedActions),
489  UpdateSupergroup(UpdateSupergroup),
490  UpdateSupergroupFullInfo(UpdateSupergroupFullInfo),
491  UpdateTermsOfService(UpdateTermsOfService),
492  UpdateTrendingStickerSets(UpdateTrendingStickerSets),
493  UpdateUnreadChatCount(UpdateUnreadChatCount),
494  UpdateUnreadMessageCount(UpdateUnreadMessageCount),
495  UpdateUser(UpdateUser),
496  UpdateUserFullInfo(UpdateUserFullInfo),
497  UpdateUserPrivacySettingRules(UpdateUserPrivacySettingRules),
498  UpdateUserStatus(UpdateUserStatus),
499  UpdateUsersNearby(UpdateUsersNearby),
500
501  AuthorizationState(AuthorizationState),
502  CanTransferOwnershipResult(CanTransferOwnershipResult),
503  ChatStatistics(ChatStatistics),
504  CheckChatUsernameResult(CheckChatUsernameResult),
505  CheckStickerSetNameResult(CheckStickerSetNameResult),
506  InternalLinkType(InternalLinkType),
507  JsonValue(JsonValue),
508  LanguagePackStringValue(LanguagePackStringValue),
509  LogStream(LogStream),
510  LoginUrlInfo(LoginUrlInfo),
511  MessageFileType(MessageFileType),
512  OptionValue(OptionValue),
513  PassportElement(PassportElement),
514  ResetPasswordResult(ResetPasswordResult),
515  StatisticalGraph(StatisticalGraph),
516  Update(Update),
517  AccountTtl(AccountTtl),
518  AnimatedEmoji(AnimatedEmoji),
519  Animations(Animations),
520  AuthenticationCodeInfo(AuthenticationCodeInfo),
521  AutoDownloadSettingsPresets(AutoDownloadSettingsPresets),
522  Background(Background),
523  Backgrounds(Backgrounds),
524  BankCardInfo(BankCardInfo),
525  BasicGroup(BasicGroup),
526  BasicGroupFullInfo(BasicGroupFullInfo),
527  BotCommands(BotCommands),
528  CallId(CallId),
529  CallbackQueryAnswer(CallbackQueryAnswer),
530  Chat(Chat),
531  ChatAdministrators(ChatAdministrators),
532  ChatEvents(ChatEvents),
533  ChatFilter(ChatFilter),
534  ChatFilterInfo(ChatFilterInfo),
535  ChatInviteLink(ChatInviteLink),
536  ChatInviteLinkCounts(ChatInviteLinkCounts),
537  ChatInviteLinkInfo(ChatInviteLinkInfo),
538  ChatInviteLinkMembers(ChatInviteLinkMembers),
539  ChatInviteLinks(ChatInviteLinks),
540  ChatJoinRequests(ChatJoinRequests),
541  ChatLists(ChatLists),
542  ChatMember(ChatMember),
543  ChatMembers(ChatMembers),
544  ChatPhotos(ChatPhotos),
545  Chats(Chats),
546  ChatsNearby(ChatsNearby),
547  ConnectedWebsites(ConnectedWebsites),
548  Count(Count),
549  Countries(Countries),
550  CustomRequestResult(CustomRequestResult),
551  DatabaseStatistics(DatabaseStatistics),
552  DeepLinkInfo(DeepLinkInfo),
553  EmailAddressAuthenticationCodeInfo(EmailAddressAuthenticationCodeInfo),
554  Emojis(Emojis),
555  Error(Error),
556  File(File),
557  FilePart(FilePart),
558  FormattedText(FormattedText),
559  FoundMessages(FoundMessages),
560  GameHighScores(GameHighScores),
561  GroupCall(GroupCall),
562  GroupCallId(GroupCallId),
563  Hashtags(Hashtags),
564  HttpUrl(HttpUrl),
565  ImportedContacts(ImportedContacts),
566  InlineQueryResults(InlineQueryResults),
567  LanguagePackInfo(LanguagePackInfo),
568  LanguagePackStrings(LanguagePackStrings),
569  LocalizationTargetInfo(LocalizationTargetInfo),
570  LogTags(LogTags),
571  LogVerbosityLevel(LogVerbosityLevel),
572  Message(Message),
573  MessageCalendar(MessageCalendar),
574  MessageLink(MessageLink),
575  MessageLinkInfo(MessageLinkInfo),
576  MessagePositions(MessagePositions),
577  MessageSenders(MessageSenders),
578  MessageStatistics(MessageStatistics),
579  MessageThreadInfo(MessageThreadInfo),
580  Messages(Messages),
581  NetworkStatistics(NetworkStatistics),
582  Ok(Ok),
583  OrderInfo(OrderInfo),
584  PassportAuthorizationForm(PassportAuthorizationForm),
585  PassportElements(PassportElements),
586  PassportElementsWithErrors(PassportElementsWithErrors),
587  PasswordState(PasswordState),
588  PaymentForm(PaymentForm),
589  PaymentReceipt(PaymentReceipt),
590  PaymentResult(PaymentResult),
591  PhoneNumberInfo(PhoneNumberInfo),
592  Proxies(Proxies),
593  Proxy(Proxy),
594  PushReceiverId(PushReceiverId),
595  RecommendedChatFilters(RecommendedChatFilters),
596  RecoveryEmailAddress(RecoveryEmailAddress),
597  ScopeNotificationSettings(ScopeNotificationSettings),
598  Seconds(Seconds),
599  SecretChat(SecretChat),
600  Session(Session),
601  Sessions(Sessions),
602  SponsoredMessage(SponsoredMessage),
603  Sticker(Sticker),
604  StickerSet(StickerSet),
605  StickerSets(StickerSets),
606  Stickers(Stickers),
607  StorageStatistics(StorageStatistics),
608  StorageStatisticsFast(StorageStatisticsFast),
609  Supergroup(Supergroup),
610  SupergroupFullInfo(SupergroupFullInfo),
611  TMeUrls(TMeUrls),
612  TemporaryPasswordState(TemporaryPasswordState),
613  TestBytes(TestBytes),
614  TestInt(TestInt),
615  TestString(TestString),
616  TestVectorInt(TestVectorInt),
617  TestVectorIntObject(TestVectorIntObject),
618  TestVectorString(TestVectorString),
619  TestVectorStringObject(TestVectorStringObject),
620  Text(Text),
621  TextEntities(TextEntities),
622  Updates(Updates),
623  User(User),
624  UserFullInfo(UserFullInfo),
625  UserPrivacySettingRules(UserPrivacySettingRules),
626  Users(Users),
627  ValidatedOrderInfo(ValidatedOrderInfo),
628  WebPage(WebPage),
629  WebPageInstantView(WebPageInstantView),
630
631}
632impl<'de> Deserialize<'de> for TdType {
633fn deserialize<D>(deserializer: D) -> Result<TdType, D::Error> where D: Deserializer<'de> {
634    use serde::de::Error;
635    rtd_enum_deserialize!(
636      TdType,
637  (testUseUpdate, TestUseUpdate);
638  (updateActiveNotifications, UpdateActiveNotifications);
639  (updateAnimatedEmojiMessageClicked, UpdateAnimatedEmojiMessageClicked);
640  (updateAnimationSearchParameters, UpdateAnimationSearchParameters);
641  (updateAuthorizationState, UpdateAuthorizationState);
642  (updateBasicGroup, UpdateBasicGroup);
643  (updateBasicGroupFullInfo, UpdateBasicGroupFullInfo);
644  (updateCall, UpdateCall);
645  (updateChatAction, UpdateChatAction);
646  (updateChatActionBar, UpdateChatActionBar);
647  (updateChatDefaultDisableNotification, UpdateChatDefaultDisableNotification);
648  (updateChatDraftMessage, UpdateChatDraftMessage);
649  (updateChatFilters, UpdateChatFilters);
650  (updateChatHasProtectedContent, UpdateChatHasProtectedContent);
651  (updateChatHasScheduledMessages, UpdateChatHasScheduledMessages);
652  (updateChatIsBlocked, UpdateChatIsBlocked);
653  (updateChatIsMarkedAsUnread, UpdateChatIsMarkedAsUnread);
654  (updateChatLastMessage, UpdateChatLastMessage);
655  (updateChatMember, UpdateChatMember);
656  (updateChatMessageSender, UpdateChatMessageSender);
657  (updateChatMessageTtl, UpdateChatMessageTtl);
658  (updateChatNotificationSettings, UpdateChatNotificationSettings);
659  (updateChatOnlineMemberCount, UpdateChatOnlineMemberCount);
660  (updateChatPendingJoinRequests, UpdateChatPendingJoinRequests);
661  (updateChatPermissions, UpdateChatPermissions);
662  (updateChatPhoto, UpdateChatPhoto);
663  (updateChatPosition, UpdateChatPosition);
664  (updateChatReadInbox, UpdateChatReadInbox);
665  (updateChatReadOutbox, UpdateChatReadOutbox);
666  (updateChatReplyMarkup, UpdateChatReplyMarkup);
667  (updateChatTheme, UpdateChatTheme);
668  (updateChatThemes, UpdateChatThemes);
669  (updateChatTitle, UpdateChatTitle);
670  (updateChatUnreadMentionCount, UpdateChatUnreadMentionCount);
671  (updateChatVideoChat, UpdateChatVideoChat);
672  (updateConnectionState, UpdateConnectionState);
673  (updateDeleteMessages, UpdateDeleteMessages);
674  (updateDiceEmojis, UpdateDiceEmojis);
675  (updateFavoriteStickers, UpdateFavoriteStickers);
676  (updateFile, UpdateFile);
677  (updateFileGenerationStart, UpdateFileGenerationStart);
678  (updateFileGenerationStop, UpdateFileGenerationStop);
679  (updateGroupCall, UpdateGroupCall);
680  (updateGroupCallParticipant, UpdateGroupCallParticipant);
681  (updateHavePendingNotifications, UpdateHavePendingNotifications);
682  (updateInstalledStickerSets, UpdateInstalledStickerSets);
683  (updateLanguagePackStrings, UpdateLanguagePackStrings);
684  (updateMessageContent, UpdateMessageContent);
685  (updateMessageContentOpened, UpdateMessageContentOpened);
686  (updateMessageEdited, UpdateMessageEdited);
687  (updateMessageInteractionInfo, UpdateMessageInteractionInfo);
688  (updateMessageIsPinned, UpdateMessageIsPinned);
689  (updateMessageLiveLocationViewed, UpdateMessageLiveLocationViewed);
690  (updateMessageMentionRead, UpdateMessageMentionRead);
691  (updateMessageSendAcknowledged, UpdateMessageSendAcknowledged);
692  (updateMessageSendFailed, UpdateMessageSendFailed);
693  (updateMessageSendSucceeded, UpdateMessageSendSucceeded);
694  (updateNewCallSignalingData, UpdateNewCallSignalingData);
695  (updateNewCallbackQuery, UpdateNewCallbackQuery);
696  (updateNewChat, UpdateNewChat);
697  (updateNewChatJoinRequest, UpdateNewChatJoinRequest);
698  (updateNewChosenInlineResult, UpdateNewChosenInlineResult);
699  (updateNewCustomEvent, UpdateNewCustomEvent);
700  (updateNewCustomQuery, UpdateNewCustomQuery);
701  (updateNewInlineCallbackQuery, UpdateNewInlineCallbackQuery);
702  (updateNewInlineQuery, UpdateNewInlineQuery);
703  (updateNewMessage, UpdateNewMessage);
704  (updateNewPreCheckoutQuery, UpdateNewPreCheckoutQuery);
705  (updateNewShippingQuery, UpdateNewShippingQuery);
706  (updateNotification, UpdateNotification);
707  (updateNotificationGroup, UpdateNotificationGroup);
708  (updateOption, UpdateOption);
709  (updatePoll, UpdatePoll);
710  (updatePollAnswer, UpdatePollAnswer);
711  (updateRecentStickers, UpdateRecentStickers);
712  (updateSavedAnimations, UpdateSavedAnimations);
713  (updateScopeNotificationSettings, UpdateScopeNotificationSettings);
714  (updateSecretChat, UpdateSecretChat);
715  (updateSelectedBackground, UpdateSelectedBackground);
716  (updateServiceNotification, UpdateServiceNotification);
717  (updateStickerSet, UpdateStickerSet);
718  (updateSuggestedActions, UpdateSuggestedActions);
719  (updateSupergroup, UpdateSupergroup);
720  (updateSupergroupFullInfo, UpdateSupergroupFullInfo);
721  (updateTermsOfService, UpdateTermsOfService);
722  (updateTrendingStickerSets, UpdateTrendingStickerSets);
723  (updateUnreadChatCount, UpdateUnreadChatCount);
724  (updateUnreadMessageCount, UpdateUnreadMessageCount);
725  (updateUser, UpdateUser);
726  (updateUserFullInfo, UpdateUserFullInfo);
727  (updateUserPrivacySettingRules, UpdateUserPrivacySettingRules);
728  (updateUserStatus, UpdateUserStatus);
729  (updateUsersNearby, UpdateUsersNearby);
730
731  (AuthorizationState, AuthorizationState);
732  (CanTransferOwnershipResult, CanTransferOwnershipResult);
733  (ChatStatistics, ChatStatistics);
734  (CheckChatUsernameResult, CheckChatUsernameResult);
735  (CheckStickerSetNameResult, CheckStickerSetNameResult);
736  (InternalLinkType, InternalLinkType);
737  (JsonValue, JsonValue);
738  (LanguagePackStringValue, LanguagePackStringValue);
739  (LogStream, LogStream);
740  (LoginUrlInfo, LoginUrlInfo);
741  (MessageFileType, MessageFileType);
742  (OptionValue, OptionValue);
743  (PassportElement, PassportElement);
744  (ResetPasswordResult, ResetPasswordResult);
745  (StatisticalGraph, StatisticalGraph);
746  (Update, Update);
747  (accountTtl, AccountTtl);
748  (animatedEmoji, AnimatedEmoji);
749  (animations, Animations);
750  (authenticationCodeInfo, AuthenticationCodeInfo);
751  (autoDownloadSettingsPresets, AutoDownloadSettingsPresets);
752  (background, Background);
753  (backgrounds, Backgrounds);
754  (bankCardInfo, BankCardInfo);
755  (basicGroup, BasicGroup);
756  (basicGroupFullInfo, BasicGroupFullInfo);
757  (botCommands, BotCommands);
758  (callId, CallId);
759  (callbackQueryAnswer, CallbackQueryAnswer);
760  (chat, Chat);
761  (chatAdministrators, ChatAdministrators);
762  (chatEvents, ChatEvents);
763  (chatFilter, ChatFilter);
764  (chatFilterInfo, ChatFilterInfo);
765  (chatInviteLink, ChatInviteLink);
766  (chatInviteLinkCounts, ChatInviteLinkCounts);
767  (chatInviteLinkInfo, ChatInviteLinkInfo);
768  (chatInviteLinkMembers, ChatInviteLinkMembers);
769  (chatInviteLinks, ChatInviteLinks);
770  (chatJoinRequests, ChatJoinRequests);
771  (chatLists, ChatLists);
772  (chatMember, ChatMember);
773  (chatMembers, ChatMembers);
774  (chatPhotos, ChatPhotos);
775  (chats, Chats);
776  (chatsNearby, ChatsNearby);
777  (connectedWebsites, ConnectedWebsites);
778  (count, Count);
779  (countries, Countries);
780  (customRequestResult, CustomRequestResult);
781  (databaseStatistics, DatabaseStatistics);
782  (deepLinkInfo, DeepLinkInfo);
783  (emailAddressAuthenticationCodeInfo, EmailAddressAuthenticationCodeInfo);
784  (emojis, Emojis);
785  (error, Error);
786  (file, File);
787  (filePart, FilePart);
788  (formattedText, FormattedText);
789  (foundMessages, FoundMessages);
790  (gameHighScores, GameHighScores);
791  (groupCall, GroupCall);
792  (groupCallId, GroupCallId);
793  (hashtags, Hashtags);
794  (httpUrl, HttpUrl);
795  (importedContacts, ImportedContacts);
796  (inlineQueryResults, InlineQueryResults);
797  (languagePackInfo, LanguagePackInfo);
798  (languagePackStrings, LanguagePackStrings);
799  (localizationTargetInfo, LocalizationTargetInfo);
800  (logTags, LogTags);
801  (logVerbosityLevel, LogVerbosityLevel);
802  (message, Message);
803  (messageCalendar, MessageCalendar);
804  (messageLink, MessageLink);
805  (messageLinkInfo, MessageLinkInfo);
806  (messagePositions, MessagePositions);
807  (messageSenders, MessageSenders);
808  (messageStatistics, MessageStatistics);
809  (messageThreadInfo, MessageThreadInfo);
810  (messages, Messages);
811  (networkStatistics, NetworkStatistics);
812  (ok, Ok);
813  (orderInfo, OrderInfo);
814  (passportAuthorizationForm, PassportAuthorizationForm);
815  (passportElements, PassportElements);
816  (passportElementsWithErrors, PassportElementsWithErrors);
817  (passwordState, PasswordState);
818  (paymentForm, PaymentForm);
819  (paymentReceipt, PaymentReceipt);
820  (paymentResult, PaymentResult);
821  (phoneNumberInfo, PhoneNumberInfo);
822  (proxies, Proxies);
823  (proxy, Proxy);
824  (pushReceiverId, PushReceiverId);
825  (recommendedChatFilters, RecommendedChatFilters);
826  (recoveryEmailAddress, RecoveryEmailAddress);
827  (scopeNotificationSettings, ScopeNotificationSettings);
828  (seconds, Seconds);
829  (secretChat, SecretChat);
830  (session, Session);
831  (sessions, Sessions);
832  (sponsoredMessage, SponsoredMessage);
833  (sticker, Sticker);
834  (stickerSet, StickerSet);
835  (stickerSets, StickerSets);
836  (stickers, Stickers);
837  (storageStatistics, StorageStatistics);
838  (storageStatisticsFast, StorageStatisticsFast);
839  (supergroup, Supergroup);
840  (supergroupFullInfo, SupergroupFullInfo);
841  (tMeUrls, TMeUrls);
842  (temporaryPasswordState, TemporaryPasswordState);
843  (testBytes, TestBytes);
844  (testInt, TestInt);
845  (testString, TestString);
846  (testVectorInt, TestVectorInt);
847  (testVectorIntObject, TestVectorIntObject);
848  (testVectorString, TestVectorString);
849  (testVectorStringObject, TestVectorStringObject);
850  (text, Text);
851  (textEntities, TextEntities);
852  (updates, Updates);
853  (user, User);
854  (userFullInfo, UserFullInfo);
855  (userPrivacySettingRules, UserPrivacySettingRules);
856  (users, Users);
857  (validatedOrderInfo, ValidatedOrderInfo);
858  (webPage, WebPage);
859  (webPageInstantView, WebPageInstantView);
860
861 )(deserializer)
862
863 }
864}
865
866impl RObject for TdType {
867  #[doc(hidden)]
868  fn td_name(&self) -> &'static str {
869    match self {
870      Self::TestUseUpdate(value) => value.td_name(),
871      Self::UpdateActiveNotifications(value) => value.td_name(),
872      Self::UpdateAnimatedEmojiMessageClicked(value) => value.td_name(),
873      Self::UpdateAnimationSearchParameters(value) => value.td_name(),
874      Self::UpdateAuthorizationState(value) => value.td_name(),
875      Self::UpdateBasicGroup(value) => value.td_name(),
876      Self::UpdateBasicGroupFullInfo(value) => value.td_name(),
877      Self::UpdateCall(value) => value.td_name(),
878      Self::UpdateChatAction(value) => value.td_name(),
879      Self::UpdateChatActionBar(value) => value.td_name(),
880      Self::UpdateChatDefaultDisableNotification(value) => value.td_name(),
881      Self::UpdateChatDraftMessage(value) => value.td_name(),
882      Self::UpdateChatFilters(value) => value.td_name(),
883      Self::UpdateChatHasProtectedContent(value) => value.td_name(),
884      Self::UpdateChatHasScheduledMessages(value) => value.td_name(),
885      Self::UpdateChatIsBlocked(value) => value.td_name(),
886      Self::UpdateChatIsMarkedAsUnread(value) => value.td_name(),
887      Self::UpdateChatLastMessage(value) => value.td_name(),
888      Self::UpdateChatMember(value) => value.td_name(),
889      Self::UpdateChatMessageSender(value) => value.td_name(),
890      Self::UpdateChatMessageTtl(value) => value.td_name(),
891      Self::UpdateChatNotificationSettings(value) => value.td_name(),
892      Self::UpdateChatOnlineMemberCount(value) => value.td_name(),
893      Self::UpdateChatPendingJoinRequests(value) => value.td_name(),
894      Self::UpdateChatPermissions(value) => value.td_name(),
895      Self::UpdateChatPhoto(value) => value.td_name(),
896      Self::UpdateChatPosition(value) => value.td_name(),
897      Self::UpdateChatReadInbox(value) => value.td_name(),
898      Self::UpdateChatReadOutbox(value) => value.td_name(),
899      Self::UpdateChatReplyMarkup(value) => value.td_name(),
900      Self::UpdateChatTheme(value) => value.td_name(),
901      Self::UpdateChatThemes(value) => value.td_name(),
902      Self::UpdateChatTitle(value) => value.td_name(),
903      Self::UpdateChatUnreadMentionCount(value) => value.td_name(),
904      Self::UpdateChatVideoChat(value) => value.td_name(),
905      Self::UpdateConnectionState(value) => value.td_name(),
906      Self::UpdateDeleteMessages(value) => value.td_name(),
907      Self::UpdateDiceEmojis(value) => value.td_name(),
908      Self::UpdateFavoriteStickers(value) => value.td_name(),
909      Self::UpdateFile(value) => value.td_name(),
910      Self::UpdateFileGenerationStart(value) => value.td_name(),
911      Self::UpdateFileGenerationStop(value) => value.td_name(),
912      Self::UpdateGroupCall(value) => value.td_name(),
913      Self::UpdateGroupCallParticipant(value) => value.td_name(),
914      Self::UpdateHavePendingNotifications(value) => value.td_name(),
915      Self::UpdateInstalledStickerSets(value) => value.td_name(),
916      Self::UpdateLanguagePackStrings(value) => value.td_name(),
917      Self::UpdateMessageContent(value) => value.td_name(),
918      Self::UpdateMessageContentOpened(value) => value.td_name(),
919      Self::UpdateMessageEdited(value) => value.td_name(),
920      Self::UpdateMessageInteractionInfo(value) => value.td_name(),
921      Self::UpdateMessageIsPinned(value) => value.td_name(),
922      Self::UpdateMessageLiveLocationViewed(value) => value.td_name(),
923      Self::UpdateMessageMentionRead(value) => value.td_name(),
924      Self::UpdateMessageSendAcknowledged(value) => value.td_name(),
925      Self::UpdateMessageSendFailed(value) => value.td_name(),
926      Self::UpdateMessageSendSucceeded(value) => value.td_name(),
927      Self::UpdateNewCallSignalingData(value) => value.td_name(),
928      Self::UpdateNewCallbackQuery(value) => value.td_name(),
929      Self::UpdateNewChat(value) => value.td_name(),
930      Self::UpdateNewChatJoinRequest(value) => value.td_name(),
931      Self::UpdateNewChosenInlineResult(value) => value.td_name(),
932      Self::UpdateNewCustomEvent(value) => value.td_name(),
933      Self::UpdateNewCustomQuery(value) => value.td_name(),
934      Self::UpdateNewInlineCallbackQuery(value) => value.td_name(),
935      Self::UpdateNewInlineQuery(value) => value.td_name(),
936      Self::UpdateNewMessage(value) => value.td_name(),
937      Self::UpdateNewPreCheckoutQuery(value) => value.td_name(),
938      Self::UpdateNewShippingQuery(value) => value.td_name(),
939      Self::UpdateNotification(value) => value.td_name(),
940      Self::UpdateNotificationGroup(value) => value.td_name(),
941      Self::UpdateOption(value) => value.td_name(),
942      Self::UpdatePoll(value) => value.td_name(),
943      Self::UpdatePollAnswer(value) => value.td_name(),
944      Self::UpdateRecentStickers(value) => value.td_name(),
945      Self::UpdateSavedAnimations(value) => value.td_name(),
946      Self::UpdateScopeNotificationSettings(value) => value.td_name(),
947      Self::UpdateSecretChat(value) => value.td_name(),
948      Self::UpdateSelectedBackground(value) => value.td_name(),
949      Self::UpdateServiceNotification(value) => value.td_name(),
950      Self::UpdateStickerSet(value) => value.td_name(),
951      Self::UpdateSuggestedActions(value) => value.td_name(),
952      Self::UpdateSupergroup(value) => value.td_name(),
953      Self::UpdateSupergroupFullInfo(value) => value.td_name(),
954      Self::UpdateTermsOfService(value) => value.td_name(),
955      Self::UpdateTrendingStickerSets(value) => value.td_name(),
956      Self::UpdateUnreadChatCount(value) => value.td_name(),
957      Self::UpdateUnreadMessageCount(value) => value.td_name(),
958      Self::UpdateUser(value) => value.td_name(),
959      Self::UpdateUserFullInfo(value) => value.td_name(),
960      Self::UpdateUserPrivacySettingRules(value) => value.td_name(),
961      Self::UpdateUserStatus(value) => value.td_name(),
962      Self::UpdateUsersNearby(value) => value.td_name(),
963    
964      Self::AuthorizationState(value) => value.td_name(),
965      Self::CanTransferOwnershipResult(value) => value.td_name(),
966      Self::ChatStatistics(value) => value.td_name(),
967      Self::CheckChatUsernameResult(value) => value.td_name(),
968      Self::CheckStickerSetNameResult(value) => value.td_name(),
969      Self::InternalLinkType(value) => value.td_name(),
970      Self::JsonValue(value) => value.td_name(),
971      Self::LanguagePackStringValue(value) => value.td_name(),
972      Self::LogStream(value) => value.td_name(),
973      Self::LoginUrlInfo(value) => value.td_name(),
974      Self::MessageFileType(value) => value.td_name(),
975      Self::OptionValue(value) => value.td_name(),
976      Self::PassportElement(value) => value.td_name(),
977      Self::ResetPasswordResult(value) => value.td_name(),
978      Self::StatisticalGraph(value) => value.td_name(),
979      Self::Update(value) => value.td_name(),
980      Self::AccountTtl(value) => value.td_name(),
981      Self::AnimatedEmoji(value) => value.td_name(),
982      Self::Animations(value) => value.td_name(),
983      Self::AuthenticationCodeInfo(value) => value.td_name(),
984      Self::AutoDownloadSettingsPresets(value) => value.td_name(),
985      Self::Background(value) => value.td_name(),
986      Self::Backgrounds(value) => value.td_name(),
987      Self::BankCardInfo(value) => value.td_name(),
988      Self::BasicGroup(value) => value.td_name(),
989      Self::BasicGroupFullInfo(value) => value.td_name(),
990      Self::BotCommands(value) => value.td_name(),
991      Self::CallId(value) => value.td_name(),
992      Self::CallbackQueryAnswer(value) => value.td_name(),
993      Self::Chat(value) => value.td_name(),
994      Self::ChatAdministrators(value) => value.td_name(),
995      Self::ChatEvents(value) => value.td_name(),
996      Self::ChatFilter(value) => value.td_name(),
997      Self::ChatFilterInfo(value) => value.td_name(),
998      Self::ChatInviteLink(value) => value.td_name(),
999      Self::ChatInviteLinkCounts(value) => value.td_name(),
1000      Self::ChatInviteLinkInfo(value) => value.td_name(),
1001      Self::ChatInviteLinkMembers(value) => value.td_name(),
1002      Self::ChatInviteLinks(value) => value.td_name(),
1003      Self::ChatJoinRequests(value) => value.td_name(),
1004      Self::ChatLists(value) => value.td_name(),
1005      Self::ChatMember(value) => value.td_name(),
1006      Self::ChatMembers(value) => value.td_name(),
1007      Self::ChatPhotos(value) => value.td_name(),
1008      Self::Chats(value) => value.td_name(),
1009      Self::ChatsNearby(value) => value.td_name(),
1010      Self::ConnectedWebsites(value) => value.td_name(),
1011      Self::Count(value) => value.td_name(),
1012      Self::Countries(value) => value.td_name(),
1013      Self::CustomRequestResult(value) => value.td_name(),
1014      Self::DatabaseStatistics(value) => value.td_name(),
1015      Self::DeepLinkInfo(value) => value.td_name(),
1016      Self::EmailAddressAuthenticationCodeInfo(value) => value.td_name(),
1017      Self::Emojis(value) => value.td_name(),
1018      Self::Error(value) => value.td_name(),
1019      Self::File(value) => value.td_name(),
1020      Self::FilePart(value) => value.td_name(),
1021      Self::FormattedText(value) => value.td_name(),
1022      Self::FoundMessages(value) => value.td_name(),
1023      Self::GameHighScores(value) => value.td_name(),
1024      Self::GroupCall(value) => value.td_name(),
1025      Self::GroupCallId(value) => value.td_name(),
1026      Self::Hashtags(value) => value.td_name(),
1027      Self::HttpUrl(value) => value.td_name(),
1028      Self::ImportedContacts(value) => value.td_name(),
1029      Self::InlineQueryResults(value) => value.td_name(),
1030      Self::LanguagePackInfo(value) => value.td_name(),
1031      Self::LanguagePackStrings(value) => value.td_name(),
1032      Self::LocalizationTargetInfo(value) => value.td_name(),
1033      Self::LogTags(value) => value.td_name(),
1034      Self::LogVerbosityLevel(value) => value.td_name(),
1035      Self::Message(value) => value.td_name(),
1036      Self::MessageCalendar(value) => value.td_name(),
1037      Self::MessageLink(value) => value.td_name(),
1038      Self::MessageLinkInfo(value) => value.td_name(),
1039      Self::MessagePositions(value) => value.td_name(),
1040      Self::MessageSenders(value) => value.td_name(),
1041      Self::MessageStatistics(value) => value.td_name(),
1042      Self::MessageThreadInfo(value) => value.td_name(),
1043      Self::Messages(value) => value.td_name(),
1044      Self::NetworkStatistics(value) => value.td_name(),
1045      Self::Ok(value) => value.td_name(),
1046      Self::OrderInfo(value) => value.td_name(),
1047      Self::PassportAuthorizationForm(value) => value.td_name(),
1048      Self::PassportElements(value) => value.td_name(),
1049      Self::PassportElementsWithErrors(value) => value.td_name(),
1050      Self::PasswordState(value) => value.td_name(),
1051      Self::PaymentForm(value) => value.td_name(),
1052      Self::PaymentReceipt(value) => value.td_name(),
1053      Self::PaymentResult(value) => value.td_name(),
1054      Self::PhoneNumberInfo(value) => value.td_name(),
1055      Self::Proxies(value) => value.td_name(),
1056      Self::Proxy(value) => value.td_name(),
1057      Self::PushReceiverId(value) => value.td_name(),
1058      Self::RecommendedChatFilters(value) => value.td_name(),
1059      Self::RecoveryEmailAddress(value) => value.td_name(),
1060      Self::ScopeNotificationSettings(value) => value.td_name(),
1061      Self::Seconds(value) => value.td_name(),
1062      Self::SecretChat(value) => value.td_name(),
1063      Self::Session(value) => value.td_name(),
1064      Self::Sessions(value) => value.td_name(),
1065      Self::SponsoredMessage(value) => value.td_name(),
1066      Self::Sticker(value) => value.td_name(),
1067      Self::StickerSet(value) => value.td_name(),
1068      Self::StickerSets(value) => value.td_name(),
1069      Self::Stickers(value) => value.td_name(),
1070      Self::StorageStatistics(value) => value.td_name(),
1071      Self::StorageStatisticsFast(value) => value.td_name(),
1072      Self::Supergroup(value) => value.td_name(),
1073      Self::SupergroupFullInfo(value) => value.td_name(),
1074      Self::TMeUrls(value) => value.td_name(),
1075      Self::TemporaryPasswordState(value) => value.td_name(),
1076      Self::TestBytes(value) => value.td_name(),
1077      Self::TestInt(value) => value.td_name(),
1078      Self::TestString(value) => value.td_name(),
1079      Self::TestVectorInt(value) => value.td_name(),
1080      Self::TestVectorIntObject(value) => value.td_name(),
1081      Self::TestVectorString(value) => value.td_name(),
1082      Self::TestVectorStringObject(value) => value.td_name(),
1083      Self::Text(value) => value.td_name(),
1084      Self::TextEntities(value) => value.td_name(),
1085      Self::Updates(value) => value.td_name(),
1086      Self::User(value) => value.td_name(),
1087      Self::UserFullInfo(value) => value.td_name(),
1088      Self::UserPrivacySettingRules(value) => value.td_name(),
1089      Self::Users(value) => value.td_name(),
1090      Self::ValidatedOrderInfo(value) => value.td_name(),
1091      Self::WebPage(value) => value.td_name(),
1092      Self::WebPageInstantView(value) => value.td_name(),
1093    
1094    }
1095  }
1096  #[doc(hidden)]
1097  fn extra(&self) -> Option<String> {
1098    match self {
1099        Self::TestUseUpdate(value) => value.extra(),
1100        Self::UpdateActiveNotifications(value) => value.extra(),
1101        Self::UpdateAnimatedEmojiMessageClicked(value) => value.extra(),
1102        Self::UpdateAnimationSearchParameters(value) => value.extra(),
1103        Self::UpdateAuthorizationState(value) => value.extra(),
1104        Self::UpdateBasicGroup(value) => value.extra(),
1105        Self::UpdateBasicGroupFullInfo(value) => value.extra(),
1106        Self::UpdateCall(value) => value.extra(),
1107        Self::UpdateChatAction(value) => value.extra(),
1108        Self::UpdateChatActionBar(value) => value.extra(),
1109        Self::UpdateChatDefaultDisableNotification(value) => value.extra(),
1110        Self::UpdateChatDraftMessage(value) => value.extra(),
1111        Self::UpdateChatFilters(value) => value.extra(),
1112        Self::UpdateChatHasProtectedContent(value) => value.extra(),
1113        Self::UpdateChatHasScheduledMessages(value) => value.extra(),
1114        Self::UpdateChatIsBlocked(value) => value.extra(),
1115        Self::UpdateChatIsMarkedAsUnread(value) => value.extra(),
1116        Self::UpdateChatLastMessage(value) => value.extra(),
1117        Self::UpdateChatMember(value) => value.extra(),
1118        Self::UpdateChatMessageSender(value) => value.extra(),
1119        Self::UpdateChatMessageTtl(value) => value.extra(),
1120        Self::UpdateChatNotificationSettings(value) => value.extra(),
1121        Self::UpdateChatOnlineMemberCount(value) => value.extra(),
1122        Self::UpdateChatPendingJoinRequests(value) => value.extra(),
1123        Self::UpdateChatPermissions(value) => value.extra(),
1124        Self::UpdateChatPhoto(value) => value.extra(),
1125        Self::UpdateChatPosition(value) => value.extra(),
1126        Self::UpdateChatReadInbox(value) => value.extra(),
1127        Self::UpdateChatReadOutbox(value) => value.extra(),
1128        Self::UpdateChatReplyMarkup(value) => value.extra(),
1129        Self::UpdateChatTheme(value) => value.extra(),
1130        Self::UpdateChatThemes(value) => value.extra(),
1131        Self::UpdateChatTitle(value) => value.extra(),
1132        Self::UpdateChatUnreadMentionCount(value) => value.extra(),
1133        Self::UpdateChatVideoChat(value) => value.extra(),
1134        Self::UpdateConnectionState(value) => value.extra(),
1135        Self::UpdateDeleteMessages(value) => value.extra(),
1136        Self::UpdateDiceEmojis(value) => value.extra(),
1137        Self::UpdateFavoriteStickers(value) => value.extra(),
1138        Self::UpdateFile(value) => value.extra(),
1139        Self::UpdateFileGenerationStart(value) => value.extra(),
1140        Self::UpdateFileGenerationStop(value) => value.extra(),
1141        Self::UpdateGroupCall(value) => value.extra(),
1142        Self::UpdateGroupCallParticipant(value) => value.extra(),
1143        Self::UpdateHavePendingNotifications(value) => value.extra(),
1144        Self::UpdateInstalledStickerSets(value) => value.extra(),
1145        Self::UpdateLanguagePackStrings(value) => value.extra(),
1146        Self::UpdateMessageContent(value) => value.extra(),
1147        Self::UpdateMessageContentOpened(value) => value.extra(),
1148        Self::UpdateMessageEdited(value) => value.extra(),
1149        Self::UpdateMessageInteractionInfo(value) => value.extra(),
1150        Self::UpdateMessageIsPinned(value) => value.extra(),
1151        Self::UpdateMessageLiveLocationViewed(value) => value.extra(),
1152        Self::UpdateMessageMentionRead(value) => value.extra(),
1153        Self::UpdateMessageSendAcknowledged(value) => value.extra(),
1154        Self::UpdateMessageSendFailed(value) => value.extra(),
1155        Self::UpdateMessageSendSucceeded(value) => value.extra(),
1156        Self::UpdateNewCallSignalingData(value) => value.extra(),
1157        Self::UpdateNewCallbackQuery(value) => value.extra(),
1158        Self::UpdateNewChat(value) => value.extra(),
1159        Self::UpdateNewChatJoinRequest(value) => value.extra(),
1160        Self::UpdateNewChosenInlineResult(value) => value.extra(),
1161        Self::UpdateNewCustomEvent(value) => value.extra(),
1162        Self::UpdateNewCustomQuery(value) => value.extra(),
1163        Self::UpdateNewInlineCallbackQuery(value) => value.extra(),
1164        Self::UpdateNewInlineQuery(value) => value.extra(),
1165        Self::UpdateNewMessage(value) => value.extra(),
1166        Self::UpdateNewPreCheckoutQuery(value) => value.extra(),
1167        Self::UpdateNewShippingQuery(value) => value.extra(),
1168        Self::UpdateNotification(value) => value.extra(),
1169        Self::UpdateNotificationGroup(value) => value.extra(),
1170        Self::UpdateOption(value) => value.extra(),
1171        Self::UpdatePoll(value) => value.extra(),
1172        Self::UpdatePollAnswer(value) => value.extra(),
1173        Self::UpdateRecentStickers(value) => value.extra(),
1174        Self::UpdateSavedAnimations(value) => value.extra(),
1175        Self::UpdateScopeNotificationSettings(value) => value.extra(),
1176        Self::UpdateSecretChat(value) => value.extra(),
1177        Self::UpdateSelectedBackground(value) => value.extra(),
1178        Self::UpdateServiceNotification(value) => value.extra(),
1179        Self::UpdateStickerSet(value) => value.extra(),
1180        Self::UpdateSuggestedActions(value) => value.extra(),
1181        Self::UpdateSupergroup(value) => value.extra(),
1182        Self::UpdateSupergroupFullInfo(value) => value.extra(),
1183        Self::UpdateTermsOfService(value) => value.extra(),
1184        Self::UpdateTrendingStickerSets(value) => value.extra(),
1185        Self::UpdateUnreadChatCount(value) => value.extra(),
1186        Self::UpdateUnreadMessageCount(value) => value.extra(),
1187        Self::UpdateUser(value) => value.extra(),
1188        Self::UpdateUserFullInfo(value) => value.extra(),
1189        Self::UpdateUserPrivacySettingRules(value) => value.extra(),
1190        Self::UpdateUserStatus(value) => value.extra(),
1191        Self::UpdateUsersNearby(value) => value.extra(),
1192      
1193        Self::AuthorizationState(value) => value.extra(),
1194        Self::CanTransferOwnershipResult(value) => value.extra(),
1195        Self::ChatStatistics(value) => value.extra(),
1196        Self::CheckChatUsernameResult(value) => value.extra(),
1197        Self::CheckStickerSetNameResult(value) => value.extra(),
1198        Self::InternalLinkType(value) => value.extra(),
1199        Self::JsonValue(value) => value.extra(),
1200        Self::LanguagePackStringValue(value) => value.extra(),
1201        Self::LogStream(value) => value.extra(),
1202        Self::LoginUrlInfo(value) => value.extra(),
1203        Self::MessageFileType(value) => value.extra(),
1204        Self::OptionValue(value) => value.extra(),
1205        Self::PassportElement(value) => value.extra(),
1206        Self::ResetPasswordResult(value) => value.extra(),
1207        Self::StatisticalGraph(value) => value.extra(),
1208        Self::Update(value) => value.extra(),
1209        Self::AccountTtl(value) => value.extra(),
1210        Self::AnimatedEmoji(value) => value.extra(),
1211        Self::Animations(value) => value.extra(),
1212        Self::AuthenticationCodeInfo(value) => value.extra(),
1213        Self::AutoDownloadSettingsPresets(value) => value.extra(),
1214        Self::Background(value) => value.extra(),
1215        Self::Backgrounds(value) => value.extra(),
1216        Self::BankCardInfo(value) => value.extra(),
1217        Self::BasicGroup(value) => value.extra(),
1218        Self::BasicGroupFullInfo(value) => value.extra(),
1219        Self::BotCommands(value) => value.extra(),
1220        Self::CallId(value) => value.extra(),
1221        Self::CallbackQueryAnswer(value) => value.extra(),
1222        Self::Chat(value) => value.extra(),
1223        Self::ChatAdministrators(value) => value.extra(),
1224        Self::ChatEvents(value) => value.extra(),
1225        Self::ChatFilter(value) => value.extra(),
1226        Self::ChatFilterInfo(value) => value.extra(),
1227        Self::ChatInviteLink(value) => value.extra(),
1228        Self::ChatInviteLinkCounts(value) => value.extra(),
1229        Self::ChatInviteLinkInfo(value) => value.extra(),
1230        Self::ChatInviteLinkMembers(value) => value.extra(),
1231        Self::ChatInviteLinks(value) => value.extra(),
1232        Self::ChatJoinRequests(value) => value.extra(),
1233        Self::ChatLists(value) => value.extra(),
1234        Self::ChatMember(value) => value.extra(),
1235        Self::ChatMembers(value) => value.extra(),
1236        Self::ChatPhotos(value) => value.extra(),
1237        Self::Chats(value) => value.extra(),
1238        Self::ChatsNearby(value) => value.extra(),
1239        Self::ConnectedWebsites(value) => value.extra(),
1240        Self::Count(value) => value.extra(),
1241        Self::Countries(value) => value.extra(),
1242        Self::CustomRequestResult(value) => value.extra(),
1243        Self::DatabaseStatistics(value) => value.extra(),
1244        Self::DeepLinkInfo(value) => value.extra(),
1245        Self::EmailAddressAuthenticationCodeInfo(value) => value.extra(),
1246        Self::Emojis(value) => value.extra(),
1247        Self::Error(value) => value.extra(),
1248        Self::File(value) => value.extra(),
1249        Self::FilePart(value) => value.extra(),
1250        Self::FormattedText(value) => value.extra(),
1251        Self::FoundMessages(value) => value.extra(),
1252        Self::GameHighScores(value) => value.extra(),
1253        Self::GroupCall(value) => value.extra(),
1254        Self::GroupCallId(value) => value.extra(),
1255        Self::Hashtags(value) => value.extra(),
1256        Self::HttpUrl(value) => value.extra(),
1257        Self::ImportedContacts(value) => value.extra(),
1258        Self::InlineQueryResults(value) => value.extra(),
1259        Self::LanguagePackInfo(value) => value.extra(),
1260        Self::LanguagePackStrings(value) => value.extra(),
1261        Self::LocalizationTargetInfo(value) => value.extra(),
1262        Self::LogTags(value) => value.extra(),
1263        Self::LogVerbosityLevel(value) => value.extra(),
1264        Self::Message(value) => value.extra(),
1265        Self::MessageCalendar(value) => value.extra(),
1266        Self::MessageLink(value) => value.extra(),
1267        Self::MessageLinkInfo(value) => value.extra(),
1268        Self::MessagePositions(value) => value.extra(),
1269        Self::MessageSenders(value) => value.extra(),
1270        Self::MessageStatistics(value) => value.extra(),
1271        Self::MessageThreadInfo(value) => value.extra(),
1272        Self::Messages(value) => value.extra(),
1273        Self::NetworkStatistics(value) => value.extra(),
1274        Self::Ok(value) => value.extra(),
1275        Self::OrderInfo(value) => value.extra(),
1276        Self::PassportAuthorizationForm(value) => value.extra(),
1277        Self::PassportElements(value) => value.extra(),
1278        Self::PassportElementsWithErrors(value) => value.extra(),
1279        Self::PasswordState(value) => value.extra(),
1280        Self::PaymentForm(value) => value.extra(),
1281        Self::PaymentReceipt(value) => value.extra(),
1282        Self::PaymentResult(value) => value.extra(),
1283        Self::PhoneNumberInfo(value) => value.extra(),
1284        Self::Proxies(value) => value.extra(),
1285        Self::Proxy(value) => value.extra(),
1286        Self::PushReceiverId(value) => value.extra(),
1287        Self::RecommendedChatFilters(value) => value.extra(),
1288        Self::RecoveryEmailAddress(value) => value.extra(),
1289        Self::ScopeNotificationSettings(value) => value.extra(),
1290        Self::Seconds(value) => value.extra(),
1291        Self::SecretChat(value) => value.extra(),
1292        Self::Session(value) => value.extra(),
1293        Self::Sessions(value) => value.extra(),
1294        Self::SponsoredMessage(value) => value.extra(),
1295        Self::Sticker(value) => value.extra(),
1296        Self::StickerSet(value) => value.extra(),
1297        Self::StickerSets(value) => value.extra(),
1298        Self::Stickers(value) => value.extra(),
1299        Self::StorageStatistics(value) => value.extra(),
1300        Self::StorageStatisticsFast(value) => value.extra(),
1301        Self::Supergroup(value) => value.extra(),
1302        Self::SupergroupFullInfo(value) => value.extra(),
1303        Self::TMeUrls(value) => value.extra(),
1304        Self::TemporaryPasswordState(value) => value.extra(),
1305        Self::TestBytes(value) => value.extra(),
1306        Self::TestInt(value) => value.extra(),
1307        Self::TestString(value) => value.extra(),
1308        Self::TestVectorInt(value) => value.extra(),
1309        Self::TestVectorIntObject(value) => value.extra(),
1310        Self::TestVectorString(value) => value.extra(),
1311        Self::TestVectorStringObject(value) => value.extra(),
1312        Self::Text(value) => value.extra(),
1313        Self::TextEntities(value) => value.extra(),
1314        Self::Updates(value) => value.extra(),
1315        Self::User(value) => value.extra(),
1316        Self::UserFullInfo(value) => value.extra(),
1317        Self::UserPrivacySettingRules(value) => value.extra(),
1318        Self::Users(value) => value.extra(),
1319        Self::ValidatedOrderInfo(value) => value.extra(),
1320        Self::WebPage(value) => value.extra(),
1321        Self::WebPageInstantView(value) => value.extra(),
1322      
1323    }
1324  }
1325  /// Return td type to json string
1326  fn to_json(&self) -> RTDResult<String> {
1327    match self {
1328        Self::TestUseUpdate(value) => value.to_json(),
1329        Self::UpdateActiveNotifications(value) => value.to_json(),
1330        Self::UpdateAnimatedEmojiMessageClicked(value) => value.to_json(),
1331        Self::UpdateAnimationSearchParameters(value) => value.to_json(),
1332        Self::UpdateAuthorizationState(value) => value.to_json(),
1333        Self::UpdateBasicGroup(value) => value.to_json(),
1334        Self::UpdateBasicGroupFullInfo(value) => value.to_json(),
1335        Self::UpdateCall(value) => value.to_json(),
1336        Self::UpdateChatAction(value) => value.to_json(),
1337        Self::UpdateChatActionBar(value) => value.to_json(),
1338        Self::UpdateChatDefaultDisableNotification(value) => value.to_json(),
1339        Self::UpdateChatDraftMessage(value) => value.to_json(),
1340        Self::UpdateChatFilters(value) => value.to_json(),
1341        Self::UpdateChatHasProtectedContent(value) => value.to_json(),
1342        Self::UpdateChatHasScheduledMessages(value) => value.to_json(),
1343        Self::UpdateChatIsBlocked(value) => value.to_json(),
1344        Self::UpdateChatIsMarkedAsUnread(value) => value.to_json(),
1345        Self::UpdateChatLastMessage(value) => value.to_json(),
1346        Self::UpdateChatMember(value) => value.to_json(),
1347        Self::UpdateChatMessageSender(value) => value.to_json(),
1348        Self::UpdateChatMessageTtl(value) => value.to_json(),
1349        Self::UpdateChatNotificationSettings(value) => value.to_json(),
1350        Self::UpdateChatOnlineMemberCount(value) => value.to_json(),
1351        Self::UpdateChatPendingJoinRequests(value) => value.to_json(),
1352        Self::UpdateChatPermissions(value) => value.to_json(),
1353        Self::UpdateChatPhoto(value) => value.to_json(),
1354        Self::UpdateChatPosition(value) => value.to_json(),
1355        Self::UpdateChatReadInbox(value) => value.to_json(),
1356        Self::UpdateChatReadOutbox(value) => value.to_json(),
1357        Self::UpdateChatReplyMarkup(value) => value.to_json(),
1358        Self::UpdateChatTheme(value) => value.to_json(),
1359        Self::UpdateChatThemes(value) => value.to_json(),
1360        Self::UpdateChatTitle(value) => value.to_json(),
1361        Self::UpdateChatUnreadMentionCount(value) => value.to_json(),
1362        Self::UpdateChatVideoChat(value) => value.to_json(),
1363        Self::UpdateConnectionState(value) => value.to_json(),
1364        Self::UpdateDeleteMessages(value) => value.to_json(),
1365        Self::UpdateDiceEmojis(value) => value.to_json(),
1366        Self::UpdateFavoriteStickers(value) => value.to_json(),
1367        Self::UpdateFile(value) => value.to_json(),
1368        Self::UpdateFileGenerationStart(value) => value.to_json(),
1369        Self::UpdateFileGenerationStop(value) => value.to_json(),
1370        Self::UpdateGroupCall(value) => value.to_json(),
1371        Self::UpdateGroupCallParticipant(value) => value.to_json(),
1372        Self::UpdateHavePendingNotifications(value) => value.to_json(),
1373        Self::UpdateInstalledStickerSets(value) => value.to_json(),
1374        Self::UpdateLanguagePackStrings(value) => value.to_json(),
1375        Self::UpdateMessageContent(value) => value.to_json(),
1376        Self::UpdateMessageContentOpened(value) => value.to_json(),
1377        Self::UpdateMessageEdited(value) => value.to_json(),
1378        Self::UpdateMessageInteractionInfo(value) => value.to_json(),
1379        Self::UpdateMessageIsPinned(value) => value.to_json(),
1380        Self::UpdateMessageLiveLocationViewed(value) => value.to_json(),
1381        Self::UpdateMessageMentionRead(value) => value.to_json(),
1382        Self::UpdateMessageSendAcknowledged(value) => value.to_json(),
1383        Self::UpdateMessageSendFailed(value) => value.to_json(),
1384        Self::UpdateMessageSendSucceeded(value) => value.to_json(),
1385        Self::UpdateNewCallSignalingData(value) => value.to_json(),
1386        Self::UpdateNewCallbackQuery(value) => value.to_json(),
1387        Self::UpdateNewChat(value) => value.to_json(),
1388        Self::UpdateNewChatJoinRequest(value) => value.to_json(),
1389        Self::UpdateNewChosenInlineResult(value) => value.to_json(),
1390        Self::UpdateNewCustomEvent(value) => value.to_json(),
1391        Self::UpdateNewCustomQuery(value) => value.to_json(),
1392        Self::UpdateNewInlineCallbackQuery(value) => value.to_json(),
1393        Self::UpdateNewInlineQuery(value) => value.to_json(),
1394        Self::UpdateNewMessage(value) => value.to_json(),
1395        Self::UpdateNewPreCheckoutQuery(value) => value.to_json(),
1396        Self::UpdateNewShippingQuery(value) => value.to_json(),
1397        Self::UpdateNotification(value) => value.to_json(),
1398        Self::UpdateNotificationGroup(value) => value.to_json(),
1399        Self::UpdateOption(value) => value.to_json(),
1400        Self::UpdatePoll(value) => value.to_json(),
1401        Self::UpdatePollAnswer(value) => value.to_json(),
1402        Self::UpdateRecentStickers(value) => value.to_json(),
1403        Self::UpdateSavedAnimations(value) => value.to_json(),
1404        Self::UpdateScopeNotificationSettings(value) => value.to_json(),
1405        Self::UpdateSecretChat(value) => value.to_json(),
1406        Self::UpdateSelectedBackground(value) => value.to_json(),
1407        Self::UpdateServiceNotification(value) => value.to_json(),
1408        Self::UpdateStickerSet(value) => value.to_json(),
1409        Self::UpdateSuggestedActions(value) => value.to_json(),
1410        Self::UpdateSupergroup(value) => value.to_json(),
1411        Self::UpdateSupergroupFullInfo(value) => value.to_json(),
1412        Self::UpdateTermsOfService(value) => value.to_json(),
1413        Self::UpdateTrendingStickerSets(value) => value.to_json(),
1414        Self::UpdateUnreadChatCount(value) => value.to_json(),
1415        Self::UpdateUnreadMessageCount(value) => value.to_json(),
1416        Self::UpdateUser(value) => value.to_json(),
1417        Self::UpdateUserFullInfo(value) => value.to_json(),
1418        Self::UpdateUserPrivacySettingRules(value) => value.to_json(),
1419        Self::UpdateUserStatus(value) => value.to_json(),
1420        Self::UpdateUsersNearby(value) => value.to_json(),
1421      
1422        Self::AuthorizationState(value) => value.to_json(),
1423        Self::CanTransferOwnershipResult(value) => value.to_json(),
1424        Self::ChatStatistics(value) => value.to_json(),
1425        Self::CheckChatUsernameResult(value) => value.to_json(),
1426        Self::CheckStickerSetNameResult(value) => value.to_json(),
1427        Self::InternalLinkType(value) => value.to_json(),
1428        Self::JsonValue(value) => value.to_json(),
1429        Self::LanguagePackStringValue(value) => value.to_json(),
1430        Self::LogStream(value) => value.to_json(),
1431        Self::LoginUrlInfo(value) => value.to_json(),
1432        Self::MessageFileType(value) => value.to_json(),
1433        Self::OptionValue(value) => value.to_json(),
1434        Self::PassportElement(value) => value.to_json(),
1435        Self::ResetPasswordResult(value) => value.to_json(),
1436        Self::StatisticalGraph(value) => value.to_json(),
1437        Self::Update(value) => value.to_json(),
1438        Self::AccountTtl(value) => value.to_json(),
1439        Self::AnimatedEmoji(value) => value.to_json(),
1440        Self::Animations(value) => value.to_json(),
1441        Self::AuthenticationCodeInfo(value) => value.to_json(),
1442        Self::AutoDownloadSettingsPresets(value) => value.to_json(),
1443        Self::Background(value) => value.to_json(),
1444        Self::Backgrounds(value) => value.to_json(),
1445        Self::BankCardInfo(value) => value.to_json(),
1446        Self::BasicGroup(value) => value.to_json(),
1447        Self::BasicGroupFullInfo(value) => value.to_json(),
1448        Self::BotCommands(value) => value.to_json(),
1449        Self::CallId(value) => value.to_json(),
1450        Self::CallbackQueryAnswer(value) => value.to_json(),
1451        Self::Chat(value) => value.to_json(),
1452        Self::ChatAdministrators(value) => value.to_json(),
1453        Self::ChatEvents(value) => value.to_json(),
1454        Self::ChatFilter(value) => value.to_json(),
1455        Self::ChatFilterInfo(value) => value.to_json(),
1456        Self::ChatInviteLink(value) => value.to_json(),
1457        Self::ChatInviteLinkCounts(value) => value.to_json(),
1458        Self::ChatInviteLinkInfo(value) => value.to_json(),
1459        Self::ChatInviteLinkMembers(value) => value.to_json(),
1460        Self::ChatInviteLinks(value) => value.to_json(),
1461        Self::ChatJoinRequests(value) => value.to_json(),
1462        Self::ChatLists(value) => value.to_json(),
1463        Self::ChatMember(value) => value.to_json(),
1464        Self::ChatMembers(value) => value.to_json(),
1465        Self::ChatPhotos(value) => value.to_json(),
1466        Self::Chats(value) => value.to_json(),
1467        Self::ChatsNearby(value) => value.to_json(),
1468        Self::ConnectedWebsites(value) => value.to_json(),
1469        Self::Count(value) => value.to_json(),
1470        Self::Countries(value) => value.to_json(),
1471        Self::CustomRequestResult(value) => value.to_json(),
1472        Self::DatabaseStatistics(value) => value.to_json(),
1473        Self::DeepLinkInfo(value) => value.to_json(),
1474        Self::EmailAddressAuthenticationCodeInfo(value) => value.to_json(),
1475        Self::Emojis(value) => value.to_json(),
1476        Self::Error(value) => value.to_json(),
1477        Self::File(value) => value.to_json(),
1478        Self::FilePart(value) => value.to_json(),
1479        Self::FormattedText(value) => value.to_json(),
1480        Self::FoundMessages(value) => value.to_json(),
1481        Self::GameHighScores(value) => value.to_json(),
1482        Self::GroupCall(value) => value.to_json(),
1483        Self::GroupCallId(value) => value.to_json(),
1484        Self::Hashtags(value) => value.to_json(),
1485        Self::HttpUrl(value) => value.to_json(),
1486        Self::ImportedContacts(value) => value.to_json(),
1487        Self::InlineQueryResults(value) => value.to_json(),
1488        Self::LanguagePackInfo(value) => value.to_json(),
1489        Self::LanguagePackStrings(value) => value.to_json(),
1490        Self::LocalizationTargetInfo(value) => value.to_json(),
1491        Self::LogTags(value) => value.to_json(),
1492        Self::LogVerbosityLevel(value) => value.to_json(),
1493        Self::Message(value) => value.to_json(),
1494        Self::MessageCalendar(value) => value.to_json(),
1495        Self::MessageLink(value) => value.to_json(),
1496        Self::MessageLinkInfo(value) => value.to_json(),
1497        Self::MessagePositions(value) => value.to_json(),
1498        Self::MessageSenders(value) => value.to_json(),
1499        Self::MessageStatistics(value) => value.to_json(),
1500        Self::MessageThreadInfo(value) => value.to_json(),
1501        Self::Messages(value) => value.to_json(),
1502        Self::NetworkStatistics(value) => value.to_json(),
1503        Self::Ok(value) => value.to_json(),
1504        Self::OrderInfo(value) => value.to_json(),
1505        Self::PassportAuthorizationForm(value) => value.to_json(),
1506        Self::PassportElements(value) => value.to_json(),
1507        Self::PassportElementsWithErrors(value) => value.to_json(),
1508        Self::PasswordState(value) => value.to_json(),
1509        Self::PaymentForm(value) => value.to_json(),
1510        Self::PaymentReceipt(value) => value.to_json(),
1511        Self::PaymentResult(value) => value.to_json(),
1512        Self::PhoneNumberInfo(value) => value.to_json(),
1513        Self::Proxies(value) => value.to_json(),
1514        Self::Proxy(value) => value.to_json(),
1515        Self::PushReceiverId(value) => value.to_json(),
1516        Self::RecommendedChatFilters(value) => value.to_json(),
1517        Self::RecoveryEmailAddress(value) => value.to_json(),
1518        Self::ScopeNotificationSettings(value) => value.to_json(),
1519        Self::Seconds(value) => value.to_json(),
1520        Self::SecretChat(value) => value.to_json(),
1521        Self::Session(value) => value.to_json(),
1522        Self::Sessions(value) => value.to_json(),
1523        Self::SponsoredMessage(value) => value.to_json(),
1524        Self::Sticker(value) => value.to_json(),
1525        Self::StickerSet(value) => value.to_json(),
1526        Self::StickerSets(value) => value.to_json(),
1527        Self::Stickers(value) => value.to_json(),
1528        Self::StorageStatistics(value) => value.to_json(),
1529        Self::StorageStatisticsFast(value) => value.to_json(),
1530        Self::Supergroup(value) => value.to_json(),
1531        Self::SupergroupFullInfo(value) => value.to_json(),
1532        Self::TMeUrls(value) => value.to_json(),
1533        Self::TemporaryPasswordState(value) => value.to_json(),
1534        Self::TestBytes(value) => value.to_json(),
1535        Self::TestInt(value) => value.to_json(),
1536        Self::TestString(value) => value.to_json(),
1537        Self::TestVectorInt(value) => value.to_json(),
1538        Self::TestVectorIntObject(value) => value.to_json(),
1539        Self::TestVectorString(value) => value.to_json(),
1540        Self::TestVectorStringObject(value) => value.to_json(),
1541        Self::Text(value) => value.to_json(),
1542        Self::TextEntities(value) => value.to_json(),
1543        Self::Updates(value) => value.to_json(),
1544        Self::User(value) => value.to_json(),
1545        Self::UserFullInfo(value) => value.to_json(),
1546        Self::UserPrivacySettingRules(value) => value.to_json(),
1547        Self::Users(value) => value.to_json(),
1548        Self::ValidatedOrderInfo(value) => value.to_json(),
1549        Self::WebPage(value) => value.to_json(),
1550        Self::WebPageInstantView(value) => value.to_json(),
1551      
1552    }
1553  }
1554}
1555
1556
1557
1558#[cfg(test)]
1559mod tests {
1560  use crate::types::{TdType, from_json, UpdateAuthorizationState};
1561
1562  #[test]
1563  fn test_deserialize_enum() {
1564    match from_json::<UpdateAuthorizationState>(r#"{"@type":"updateAuthorizationState","authorization_state":{"@type":"authorizationStateWaitTdlibParameters"}}"#) {
1565      Ok(t) => {},
1566      Err(e) => {panic!("{}", e)}
1567    };
1568
1569    match from_json::<TdType>(r#"{"@type":"updateAuthorizationState","authorization_state":{"@type":"authorizationStateWaitTdlibParameters"}}"#) {
1570      Ok(t) => {
1571        match t {
1572          TdType::UpdateAuthorizationState(v) => {},
1573          _ => panic!("from_json failed: {:?}", t)
1574        }
1575      },
1576      Err(e) => {panic!("{}", e)}
1577    };
1578  }
1579}
1580
1581