Skip to content

Commit

Permalink
docs: show using the ? operator with different functions
Browse files Browse the repository at this point in the history
Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
  • Loading branch information
npmccallum committed Apr 20, 2022
1 parent e50a9a2 commit af91968
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions axum-core/src/response/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,17 @@ pub type Response<T = BoxBody> = http::Response<T>;
/// http::StatusCode,
/// };
///
/// fn foo() -> Result<(), (StatusCode, &'static str)> {
/// Err((StatusCode::NOT_FOUND, "not found"))
/// }
///
/// fn bar() -> Result<(), StatusCode> {
/// Err(StatusCode::BAD_REQUEST)
/// }
///
/// fn handler() -> Result<&'static str> {
/// Err((StatusCode::NOT_FOUND, "not found"))?;
/// Err(StatusCode::BAD_REQUEST)?;
/// foo()?;
/// bar()?;
/// Ok("ok")
/// }
/// ```
Expand Down

0 comments on commit af91968

Please sign in to comment.