pub async fn invoke<R: tl::RemoteCall>(
        &self,
        request: &R,
    ) -> Result<R::Return, InvocationError> {
        let mut rx = self.0.request_tx.lock("invoke").enqueue(request);
        loop {
            match rx.try_recv() {
                Ok(response) => {
                    break match response {
                        Ok(body) => R::Return::from_bytes(&body).map_err(|e| e.into()),
                        Err(err) => Err(err),
                    }
                }
                Err(TryRecvError::Empty) => {
                    self.step().await?;
                }
                Err(TryRecvError::Closed) => {
                    panic!("request channel dropped before receiving a result")
                }
            }
        }
    }
/// Invoke a raw API call. This directly sends the request to Telegram's servers.
///
/// Using function definitions corresponding to a different layer is likely to cause the
/// responses to the request to not be understood.
///
/// <div class="stab unstable">
///
/// **Warning**: this method is **not** part of the stability guarantees of semantic
/// versioning. It **may** break during *minor* version changes (but not on patch version
/// changes). Use with care.
///
/// </div>
///
/// # Examples
///
/// ```
/// # async fn f(mut client: grammers_client::Client) -> Result<(), Box<dyn std::error::Error>> {
/// use grammers_tl_types as tl;
///
/// dbg!(client.invoke(&tl::functions::Ping { ping_id: 0 }).await?);
/// # Ok(())
/// # }
/// ```
Invoke a raw API call. This directly sends the request to Telegram's servers.
Using function definitions corresponding to a different layer is likely to cause the
responses to the request to not be understood.






Invoke a raw API call . This directly sends the request to Telegram ' s servers . Using function definitions corresponding to a different layer is likely to cause the responses to the request to not be understood .
pub async fn invoke<R: tl::RemoteCall>(
        &self,
        request: &R,
    ) -> Result<R::Return, InvocationError> {
        let mut rx = self.0.request_tx.lock("invoke").enqueue(request);
        loop {
            match rx.try_recv() {
                Ok(response) => {
                    break match response {
                        Ok(body) => R::Return::from_bytes(&body).map_err(|e| e.into()),
                        Err(err) => Err(err),
                    }
                }
                Err(TryRecvError::Empty) => {
                    self.step().await?;
                }
                Err(TryRecvError::Closed) => {
                    panic!("request channel dropped before receiving a result")
                }
            }
        }
    }
pub async fn invoke < R : tl :: RemoteCall > ( & self , request : & R , ) -> Result < R :: Return , InvocationError > { let mut rx = self . 0 . request_tx . lock ( " " ) . enqueue ( request ) ; loop { match rx . try_recv ( ) { Ok ( response ) => { break match response { Ok ( body ) => R :: Return :: from_bytes ( & body ) . map_err ( | e | e . into ( ) ) , Err ( err ) => Err ( err ) , } } Err ( TryRecvError :: Empty ) => { self . step ( ) . await ? ; } Err ( TryRecvError :: Closed ) => { panic ! ( " " ) } } } }
Invoke a raw API call.
Invoke a raw API call .
&self
request
&R
&self
request
&R
examples
None
async fn f(mut client: grammers_client::client) -> result<(), box<dyn std::error::error>> {
use grammers_tl_types as tl.

dbg!(client.invoke(&tl::functions::Ping { ping_id: 0 }).await?).
use grammers_tl_types as tl . dbg! ( client . invoke ( &tl :: functions :: Ping { ping_id : 0 } ) . await? ) .
ok(())
None
}
None