4 releases (2 stable)

1.0.1 Jan 15, 2024
1.0.0 Oct 28, 2023
0.1.1 Mar 21, 2023
0.1.0 Feb 19, 2023

#342 in Procedural macros

41 downloads per month
Used in create-rust-app_cli

MIT/Apache

43KB
1K SLoC

Generated reat-query hooks for your services in actix-web, poem, axum, you-name-it.

Makes many assumptions!

  • Works with a particular version of react-query (last tested on: "react-query": "^3.39.3")
  • Endpoints return JSON (i.e. fetch(..).json() should work)
  • Directory structure determines API paths!
  • Just use #[qsync] above your method names.
  • You can also specify a typescript return type like #[qsync(return_type="string[]")] or whether it's a mutation or not (#[qsync(mutate)]).
  • When using a web framework like actix_web, make sure to declare the qsync attribute above above #[get("..")] or similar attributes which denote the endpoint's method and path. Rust evaluates macros from outer-most to the inner-most which means order is important!

See https://github.com/Wulf/create-rust-app.

Dependencies

~4–5.5MB
~98K SLoC