59 Commits

Author SHA1 Message Date
Jason Volk
fd11fee88d optimize for optional static response headers zero-copy zero-alloc
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-12 22:59:57 +00:00
Jason Volk
a6e340e24d estimate and reserve capacity in outgoing headers map
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-12 22:57:38 +00:00
Jason Volk
767b7c72f7 Fix assumptions about header value types
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-12 20:56:31 +00:00
strawberry
9a5bfad849 Merge remote-tracking branch 'upstream/main' into conduwuit-changes 2024-06-30 11:54:39 -04:00
Jason Volk
cdac2a88f8 GATs are stable
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-25 05:44:50 +00:00
Kévin Commaille
968c52b117 api: Rename request macro attribute query_map to query_all
Remove its IntoIterator bound to allow to represent
the query fields as a single struct or enum.
2024-06-21 19:15:59 +02:00
Kévin Commaille
f535ce700d macros: Remove dead code 2024-05-12 15:49:28 +02:00
Kévin Commaille
d6c4533b7d chore: Fix new warnings 2024-05-12 15:49:28 +02:00
avdb13
8881755235
api: Add status parameter to request attribute macro
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2024-04-24 14:44:49 +02:00
Jonas Platte
3dac70ead9
Remove most unreachable visibility modifiers 2023-07-19 14:32:14 +02:00
Jonas Platte
53622f8ce0
macros: Upgrade syn to 2.0 2023-04-24 17:02:23 +02:00
HKalbasi
ca99c97a0c
Use #[deprecated] instead of doc comments 2023-02-12 19:18:06 +01:00
Jonas Platte
ff8ab6b085
Replace ruma_common::serde::urlencoded with serde_html_form 2023-01-02 17:47:33 +01:00
Jonas Platte
3211fccab0
Remove borrowing in requests 2022-11-28 14:02:35 +01:00
Jonas Platte
bdb5950fe4 macros: Remove ruma_api! macro 2022-11-12 10:17:24 +01:00
Jonas Platte
2500e8f8fa api: Make query_string parameter of make_endpoint_url non-optional
When Some(_), the argument would often be an empty string. By always
using the empty string to mean "no query", we avoid trailing a `?` on
URLs without having two parameter values that mean the same thing.
2022-11-11 11:27:07 +01:00
Jonas Platte
a8ba82d585 api: Make EndpointError construction infallible
Simplifies error matching and preserves more information for
non-spec-compliant server errors.
2022-11-10 13:10:57 +01:00
Jonas Platte
7d018897b0
macros: Move ensure_feature_presence check from ruma_api to request / response 2022-11-10 11:33:18 +01:00
Jonas Platte
2451f33a64
api: Replace ruma_api! compile-time path check with a test 2022-11-10 11:33:17 +01:00
Jonas Platte
8d0f817f48
api: Allow incoming request method of HEAD for GET endpoints 2022-11-02 23:26:57 +01:00
Jonas Platte
f613137b31
macros: Add response attribute macro 2022-11-01 09:39:11 +01:00
Jonas Platte
af97ddaa58
macros: Remove unnecessary type distinction 2022-10-31 10:00:50 +01:00
Jonas Platte
b7c47c9e70
macros: Always implement IncomingRequest trait on IncomingRequest type
… rather than the `Request` type, even if `IncomingRequest` is a type
alias for it.

This (only) affects where the implementation is shown in the
documentation.
2022-10-31 09:58:36 +01:00
Jonas Platte
ec67fcbd6f api: Use VersionHistory::new from ruma_api!
… and remove a now-redundant check from the macro code.
2022-10-28 10:38:52 +02:00
Jonas Platte
c7e84c5249
Fix clippy lints
Automated using `cargo clippy --fix`.
2022-10-26 13:38:29 +02:00
Jonas Platte
f22857e682
macros: Add request attribute macro 2022-10-24 15:28:50 +02:00
Jonas Platte
c021a14b60
macros: Rename error_ty => error 2022-10-24 15:28:50 +02:00
Jonas Platte
1be2def65a
Revert "api: Remove error_ty from Request and Response derive attributes"
This reverts commit 1989e0350d61ca769b258ce5f2f48360dc4b3f3c.
2022-10-24 15:28:50 +02:00
Jonas Platte
876e8e38aa
macros: Simplify Response derive attribute parsing 2022-10-22 12:25:27 +02:00
Jonas Platte
dff84efb0c
api: Remove authentication from Request derive attributes 2022-10-22 12:25:27 +02:00
Jonas Platte
c9bd9bf00b
api: Remove NonAuthRequest traits 2022-10-22 12:24:22 +02:00
Jonas Platte
1989e0350d
api: Remove error_ty from Request and Response derive attributes 2022-10-22 12:24:22 +02:00
Jonas Platte
e7e39a6af1
api: Remove method from Request derive attributes 2022-10-22 12:24:21 +02:00
Jonas Platte
70c5e84107
macros: Remove unnecessary self:: qualitication 2022-10-22 11:29:58 +02:00
Jonas Platte
ec31badd84
api: Replace path fields in Metadata with new VersionHistory type
Co-authored-by: Jonathan de Jong <jonathan@automatia.nl>
2022-10-22 11:17:55 +02:00
Jonas Platte
6642686b58
macros: Remove unused custom keywords 2022-10-22 11:12:52 +02:00
Jonas Platte
764e96a254
api: Enforce consistent path field order 2022-10-20 20:51:09 +02:00
Kévin Commaille
739c35aaca api: Allow to use any HeaderName with the header keyword of ruma_api 2022-10-10 19:09:39 +02:00
Kévin Commaille
d55573a555 api: Remove AuthScheme::QueryOnlyAccessToken
It is no longer used by the Appservice API.
2022-10-02 15:08:31 +02:00
Jonas Platte
715c226975 api: Make select_path and make_endpoint_url methods on Metadata
… and remove #[doc(hidden)] attribute.
2022-09-29 15:49:39 +02:00
Jonas Platte
8290d712f2 api: Move the majority of endpoint URL building out of macro code 2022-09-29 15:49:39 +02:00
Jonas Platte
a6e23d731e api: Slighty reduce the amount of macro-generated code
By moving format(_args)! usage into a regular fn and calling that from
the proc-macro-generated code.
2022-09-29 15:49:39 +02:00
Jonas Platte
2dbaf19ded
macros: Refactor ResponseField 2022-09-26 16:03:05 +02:00
Jonas Platte
a59a648d04
macros: Refactor RequestField 2022-09-26 15:48:45 +02:00
Jonas Platte
c745d3baf7
Fix clippy lint 2022-09-02 14:07:28 +02:00
Marcel Hellwig
92f862e279
macros: Generate certain structs only with client or server feature enabled
If neither the client, nor the server feature is enabled the fields are
unused and therefore trigger the dead_code lint.
2022-06-22 14:15:37 +02:00
Jonas Platte
8912182c56
Increase usage of implicit named arguments in format strings 2022-06-03 10:06:28 +02:00
Jonas Platte
73c2963ebd
Enforce consistent semicolons after ()-typed expressions in blocks 2022-06-03 08:40:16 +02:00
Jonas Platte
5f902851af
Upgrade to Rust 2021 2022-05-27 12:04:23 +02:00
Kévin Commaille
734770d2bc
macros: Refactor ruma_api attributes parsing 2022-05-23 21:51:47 +02:00