Advertisement
Guest User

Untitled

a guest
Dec 27th, 2023
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.37 KB | None | 0 0
  1. error[E0308]: mismatched types
  2. --> src/handler.rs:88:46
  3. |
  4. 88 | Err((StatusCode::NOT_FOUND, Json("Record not found")))
  5. | ---- ^^^^^^^^^^^^^^^^^^ expected `Value`, found `&str`
  6. | |
  7. | arguments to this struct are incorrect
  8. |
  9. help: the type constructed contains `&'static str` due to the type of the argument passed
  10. --> src/handler.rs:88:41
  11. |
  12. 88 | Err((StatusCode::NOT_FOUND, Json("Record not found")))
  13. | ^^^^^------------------^
  14. | |
  15. | this argument influences the type of `Json`
  16. note: tuple struct defined here
  17. --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-0.6.12/src/json.rs:101:12
  18. |
  19. 101 | pub struct Json<T>(pub T);
  20. | ^^^^
  21. help: call `Into::into` on this expression to convert `&'static str` into `JsonValue`
  22. |
  23. 88 | Err((StatusCode::NOT_FOUND, Json("Record not found".into())))
  24. | +++++++
  25.  
  26. error[E0308]: mismatched types
  27. --> src/handler.rs:93:58
  28. |
  29. 93 | Err((StatusCode::INTERNAL_SERVER_ERROR, Json("Internal server error")))
  30. | ---- ^^^^^^^^^^^^^^^^^^^^^^^ expected `Value`, found `&str`
  31. | |
  32. | arguments to this struct are incorrect
  33. |
  34. help: the type constructed contains `&'static str` due to the type of the argument passed
  35. --> src/handler.rs:93:53
  36. |
  37. 93 | Err((StatusCode::INTERNAL_SERVER_ERROR, Json("Internal server error")))
  38. | ^^^^^-----------------------^
  39. | |
  40. | this argument influences the type of `Json`
  41. note: tuple struct defined here
  42. --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-0.6.12/src/json.rs:101:12
  43. |
  44. 101 | pub struct Json<T>(pub T);
  45. | ^^^^
  46. help: call `Into::into` on this expression to convert `&'static str` into `JsonValue`
  47. |
  48. 93 | Err((StatusCode::INTERNAL_SERVER_ERROR, Json("Internal server error".into())))
  49. | +++++++
  50.  
  51. error[E0277]: the trait bound `fn(axum::extract::Path<i64>, axum::extract::State<Arc<AppState>>) -> impl std::future::Future<Output = Result<impl IntoResponse, (axum::http::StatusCode, axum::Json<JsonValue>)>> {comments_list_handler}: Handler<_, _, _>` is not satisfied
  52. --> src/route.rs:20:42
  53. |
  54. 20 | .route("/observaciones/:id", get(comments_list_handler))
  55. | --- ^^^^^^^^^^^^^^^^^^^^^ the trait `Handler<_, _, _>` is not implemented for fn item `fn(axum::extract::Path<i64>, axum::extract::State<Arc<AppState>>) -> impl std::future::Future<Output = Result<impl IntoResponse, (axum::http::StatusCode, axum::Json<JsonValue>)>> {comments_list_handler}`
  56. | |
  57. | required by a bound introduced by this call
  58. |
  59. = help: the following other types implement trait `Handler<T, S, B>`:
  60. <Layered<L, H, T, S, B, B2> as Handler<T, S, B2>>
  61. <MethodRouter<S, B> as Handler<(), S, B>>
  62. note: required by a bound in `axum::routing::get`
  63. --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-0.6.12/src/routing/method_routing.rs:403:1
  64. |
  65. 403 | top_level_handler_fn!(get, GET);
  66. | ^^^^^^^^^^^^^^^^^^^^^^---^^^^^^
  67. | | |
  68. | | required by a bound in this function
  69. | required by this bound in `get`
  70. = note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
  71.  
  72. Some errors have detailed explanations: E0277, E0308.
  73. For more information about an error, try `rustc --explain E0277`.
  74. error: could not compile `rust-axum-postgres-api` (bin "rust-axum-postgres-api") due to 3 previous errors
  75.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement