pub fn execute<F: Function>(request: &F) -> Result<F::Return>Expand description
Executes a supported synchronous TDLib function and decodes its response.
Only generated functions documented by TDLib as synchronously executable
are supported, such as getFileMimeType. This does not require a Session.
This is a synchronous call directly to td_execute. Because TDLib stores
output in thread-local storage, it executes immediately without acquiring locks
or waiting for an in-progress set_receive_timeout. Do not call it from on_error.
§Errors
Returns Error::Td for native errors, Error::Json for encoding or
decoding failures, and Error::UnexpectedResponse for a null response.
§Examples
use td_client::execute;
use td_types::{enums::Text, fns};
let Text::text(mime) = execute(
&fns::getFileMimeType { file_name: "picture.png".into() }
)?;
assert_eq!(mime.text, "image/png");