pub enum Download {
NoPath,
Network(Error),
InvalidStatusCode(StatusCode),
Io(Error),
}
Expand description
Represents possible errors which may occur while downloading a file.
Variants§
NoPath
The provided file’s path
is None
.
Network(Error)
A network error.
InvalidStatusCode(StatusCode)
Telegram returned a status code different from 200
.
Io(Error)
Failed to read a local file. This can only be returned if you use a self-hosted Bot API server.
Implementations§
source§impl Download
impl Download
sourcepub fn is_no_path(&self) -> bool
pub fn is_no_path(&self) -> bool
Returns true
if self
is of variant NoPath
.
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_invalid_status_code(&self) -> bool
pub fn is_invalid_status_code(&self) -> bool
Returns true
if self
is of variant InvalidStatusCode
.
sourcepub fn expect_invalid_status_code(self) -> StatusCodewhere
Self: Debug,
pub fn expect_invalid_status_code(self) -> StatusCodewhere
Self: Debug,
Unwraps the value, yielding the content of InvalidStatusCode
.
Panics
Panics if the value is not InvalidStatusCode
, with a panic message including the content of self
.
sourcepub fn invalid_status_code(self) -> Option<StatusCode>
pub fn invalid_status_code(self) -> Option<StatusCode>
Returns Some
if self
is of variant InvalidStatusCode
, and None
otherwise.
Trait Implementations§
source§impl Error for Download
impl Error for Download
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
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<StatusCode> for Download
impl From<StatusCode> for Download
source§fn from(error: StatusCode) -> Self
fn from(error: StatusCode) -> Self
Converts to this type from the input type.