pub enum MethodCall {
Network(Error),
OutOfService,
Parse {
response: Vec<u8>,
error: Error,
},
RequestError {
description: String,
error_code: u16,
migrate_to_chat_id: Option<Id>,
retry_after: Option<u64>,
},
}Expand description
Represents possible errors that may happen during a method call.
Variants§
Network(Error)
A network error.
OutOfService
Bot API is likely to be down.
Parse
Failed to parse the response.
Fields
RequestError
An error returned in response.
Fields
Implementations§
Source§impl MethodCall
impl MethodCall
Sourcepub fn is_network(&self) -> bool
pub fn is_network(&self) -> bool
Returns true if self is of variant Network.
Sourcepub fn expect_network(self) -> Errorwhere
Self: Debug,
pub fn expect_network(self) -> Errorwhere
Self: Debug,
Sourcepub fn network(self) -> Option<Error>
pub fn network(self) -> Option<Error>
Returns Some if self is of variant Network, and None otherwise.
Sourcepub fn is_out_of_service(&self) -> bool
pub fn is_out_of_service(&self) -> bool
Returns true if self is of variant OutOfService.
Sourcepub fn is_request_error(&self) -> bool
pub fn is_request_error(&self) -> bool
Returns true if self is of variant RequestError.
Trait Implementations§
Source§impl Debug for MethodCall
impl Debug for MethodCall
Source§impl Display for MethodCall
impl Display for MethodCall
Source§impl Error for MethodCall
impl Error for MethodCall
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<Error> for MethodCall
impl From<Error> for MethodCall
Source§impl From<MethodCall> for HttpWebhook
impl From<MethodCall> for HttpWebhook
Source§fn from(error: MethodCall) -> Self
fn from(error: MethodCall) -> Self
Converts to this type from the input type.
Source§impl From<MethodCall> for HttpsWebhook
impl From<MethodCall> for HttpsWebhook
Source§fn from(error: MethodCall) -> Self
fn from(error: MethodCall) -> Self
Converts to this type from the input type.
Source§impl From<MethodCall> for Polling
impl From<MethodCall> for Polling
Source§fn from(error: MethodCall) -> Self
fn from(error: MethodCall) -> Self
Converts to this type from the input type.
Source§impl From<MethodCall> for PollingSetup
impl From<MethodCall> for PollingSetup
Source§fn from(error: MethodCall) -> Self
fn from(error: MethodCall) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for MethodCall
impl !RefUnwindSafe for MethodCall
impl Send for MethodCall
impl Sync for MethodCall
impl Unpin for MethodCall
impl !UnwindSafe for MethodCall
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more