pub trait IntoResponse: Send {
// Required method
fn into_response(self) -> Response;
}Expand description
Trait for converting types into bot responses
Similar to skyzen’s Responder trait, this allows handlers to
return various types that get converted to responses.
§Example
ⓘ
// Return a string directly
async fn ping() -> &'static str {
"Pong!"
}
// Return a formatted string
async fn greet(user: User) -> String {
format!("Hello, {}!", user.name)
}
// Return Response for full control
async fn buttons() -> Response {
Response::text("Click a button:")
.with_components(vec![...])
}Required Methods§
Sourcefn into_response(self) -> Response
fn into_response(self) -> Response
Convert this type into a bot response