/// A generic "error" for HTTP connections /// /// This error type is less specific than the error returned from other /// functions in this crate, but all other errors can be converted to this /// error. Consumers of this crate can typically consume and work with this form /// of error for conversions with the `?` operator. pubstruct Error {
inner: ErrorKind,
}
/// A `Result` typedef to use with the `http::Error` type pubtype Result<T> = result::Result<T, Error>;
impl Error { /// Return true if the underlying error has the same type as T. pubfn is<T: error::Error + 'static>(&self) -> bool { self.get_ref().is::<T>()
}
/// Return a reference to the lower level, inner error. pubfn get_ref(&self) -> &(dyn error::Error + 'static) { useself::ErrorKind::*;
matchself.inner {
StatusCode(ref e) => e,
Method(ref e) => e,
Uri(ref e) => e,
UriParts(ref e) => e,
HeaderName(ref e) => e,
HeaderValue(ref e) => e,
}
}
}
impl error::Error for Error { // Return any available cause from the inner error. Note the inner error is // not itself the cause. fn source(&self) -> Option<&(dyn error::Error + 'static)> { self.get_ref().source()
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.