-
/// example 1:
#[handler]
fn index(remote_addr: &RemoteAddr, method: Method, uri: &Uri) {}
/// example 2:
#[handler]
fn index(res: Result<Query<Params>>) -> Result<impl IntoResponse> {}
/// example 3:
#[handler]
fn hello(Path(name): Path<String>) -> String {
format!("hello: {}", name)
}
/// example 4:
#[handler]
fn ws(
Path(name): Path<String>,
ws: WebSocket,
sender: Data<&tokio::sync::broadcast::Sender<String>>,
) -> impl IntoResponse {
}
/// example 5:
#[handler]
async fn index(ws: WebSocket) -> impl IntoResponse {
ws.protocols(vec!["graphql-rs", "graphql-transport-ws"])
.on_upgrade(|socket| async move {
// ...
})
} 每个例子都有不同的参数, 怎么知道都可以用那些参数? |
Beta Was this translation helpful? Give feedback.
Answered by
sunli829
Mar 11, 2022
Replies: 1 comment
-
https://docs.rs/poem/1.3.14/poem/web/trait.FromRequest.html#provided-implementations |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
chanble
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://docs.rs/poem/1.3.14/poem/web/trait.FromRequest.html#provided-implementations