pub struct Error {
pub debug: String,
pub message: String,
}Fields§
§debug: String§message: StringImplementations§
Source§impl Error
impl Error
pub fn new(message: impl ToString) -> Self
Sourcepub fn wrap<E: Error>(message: impl ToString) -> impl FnOnce(E) -> Self
pub fn wrap<E: Error>(message: impl ToString) -> impl FnOnce(E) -> Self
Wraps any printable error, with the debug output in the debug field
§Tests
let error = quokka_handler::Error::wrap("A test error")(quokka_handler::Error::new("Test Error"));
let message = format!("{}", error);
let debug = format!("{:?}", error);
assert_eq!(message, "A test error");
assert_eq!(debug, "Test Error");Sourcepub async fn wrap_response(response: impl IntoResponse) -> Self
pub async fn wrap_response(response: impl IntoResponse) -> Self
Wraps any printable error, with the debug output in the debug field
§Tests
#[tokio::main]
async fn main() {
let error = quokka_handler::Error::wrap_response(String::from("A test error")).await;
let message = format!("{}", error);
assert_eq!(message, "A test error");
}Trait Implementations§
Source§impl Debug for Error
§Tests
let error = format!("{}", quokka_handler::Error::new("Test Error"));
assert_eq!(error, "Test Error");
impl Debug for Error
§Tests
let error = format!("{}", quokka_handler::Error::new("Test Error"));
assert_eq!(error, "Test Error");Source§impl Display for Error
§Tests
let error = format!("{:?}", quokka_handler::Error { message: String::new(), debug: String::from("Test Debug") });
assert_eq!(error, "Test Debug");
impl Display for Error
§Tests
let error = format!("{:?}", quokka_handler::Error { message: String::new(), debug: String::from("Test Debug") });
assert_eq!(error, "Test Debug");Source§impl Error for Error
impl Error for Error
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()
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
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