271 Commits

Author SHA1 Message Date
Jason Volk
010ae6daad add missing TimelineEventType -> StateEventType conversion replacing anti-pattern to_string().into()
Signed-off-by: Jason Volk <jason@zemos.net>
2025-01-29 23:03:04 +00:00
Jason Volk
427877d5bc identifiers: add clone from owned reference
Signed-off-by: Jason Volk <jason@zemos.net>
2025-01-22 06:30:05 +00:00
Jason Volk
ac37db212a fix lints
Signed-off-by: Jason Volk <jason@zemos.net>
2025-01-01 22:20:39 +00:00
Jason Volk
814df8faf2 add capacity() and missing len() to Owned identifier interface
Signed-off-by: Jason Volk <jason@zemos.net>
2025-01-01 21:52:10 +00:00
Jason Volk
30a08ff7be various identifiers macro optimizations
Signed-off-by: Jason Volk <jason@zemos.net>
2024-12-28 23:43:56 +00:00
Jason Volk
54da128bbe refactor owned identifiers using SmallVec 2024-12-28 01:06:09 +00:00
Jason Volk
9bdc048cdb various inlines
Signed-off-by: Jason Volk <jason@zemos.net>
2024-12-19 14:02:45 +00:00
Jade Ellis
ad417daad8
reserve the correct amount of headers 2024-12-17 22:04:17 +00:00
Kévin Commaille
f05d0e03a1 api: Disallow #[serde(flatten)] for single-body-fields of requests and responses
`#[ruma_api(body)]` must be used instead.
2024-12-15 03:07:49 -05:00
Kévin Commaille
9a765f9d2b identifiers: Improve docs of IdZst macro 2024-12-15 02:57:05 -05:00
Kévin Commaille
f2b58e5e07 macros: Remove dependency to once_cell
Use OnceLock from std instead.
2024-11-29 17:36:33 -05:00
Jason Volk
dcf6d7e04a ensure uses of canonical-json are property gated
Signed-off-by: Jason Volk <jason@zemos.net>
2024-11-09 06:27:02 +00:00
Kévin Commaille
35da79a26e identifiers: Make DeviceKeyId a type alias of KeyId 2024-11-08 13:13:19 -05:00
Kévin Commaille
7f8f89eff7 identifiers: Differentiate signing keys from device keys
Use OwnedCrossSigningKeyId, OwnedDeviceSigningKeyId and
OwnedCrossSigningOrDeviceSigningKeyId instead of OwnedDeviceKeyId
to identify signing keys.
2024-11-08 13:13:15 -05:00
Kévin Commaille
ae3897cad8 identifiers: Allow to validate KeyId with any key name type
Use new trait bounds for KeyId to only allow specific types.
Change the KeyId validation to be generic over the key name type.
Remove the KeyName type and replace it with the more specific
ServerSigningKeyVersion.
2024-11-08 12:49:53 -05:00
Jason Volk
8ce5d8eb87 reserve outgoing request headers
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-30 05:40:07 +00:00
Jason Volk
d96d981475 Make to_cow_str() for event types public as at least some hedge against unconditional to_string().
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-25 02:44:06 +00:00
Jason Volk
3109496a1f expose MAX_BYTES as an associated constant for identifiers
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-09 10:34:00 +00:00
Jason Volk
f485a0265c Support let sender: &UserId = value.get("sender").try_into()?;
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-03 01:59:24 +00:00
Jason Volk
1d0b06b581 fix tests for ContentDisposition macro support
Signed-off-by: Jason Volk <jason@zemos.net>
2024-09-24 19:21:09 +00:00
strawberry
b6f82a72b6 Merge remote-tracking branch 'upstream/main' into conduwuit-changes 2024-09-13 16:35:24 -04:00
Jonas Platte
1a138ed6c9 Use workspace lint configuration instead of rustflags hack 2024-09-11 07:13:32 +00:00
strawberry
11155e576a Merge remote-tracking branch 'upstream/main' into conduwuit-changes 2024-09-07 12:20:19 -04:00
Jonas Platte
4547da0b7b Fix CI by changing where deprecations are added and allowed 2024-09-07 14:31:24 +00:00
Jonas Platte
6a049c93a1 macros: Fix METADATA references in generated tests 2024-09-07 14:31:24 +00:00
Jonas Platte
83acca397b macros: Fix test cfg in macro output 2024-09-07 14:31:24 +00:00
strawberry
b003338b90 Merge remote-tracking branch 'upstream/main' into conduwuit-changes 2024-09-07 08:18:57 -04:00
Jonas Platte
0e8388abab macros: Add __internal_macro_expand feature for better RA macro expansion 2024-09-07 07:57:30 +00:00
Jonas Platte
79025dfca4 macros: Improve internal assertions 2024-09-07 07:57:30 +00:00
Jonas Platte
de6b08a2b5 macros: Simplify internal derive macro input parsing 2024-09-07 07:57:30 +00:00
Jason Volk
3f06ade0fd Revert "Revert "optimize for optional static response headers zero-copy zero-alloc""
This reverts commit 6bdc5ad326029e84fe05ed2591d9ba442bab8ff5.

Revert "Revert "Fix assumptions about header value types""

This reverts commit 03037f6c92ffb43388022d288e5a36f20a8559dd.
2024-08-15 05:20:21 +00:00
Jason Volk
11cbd52af1 estimate and reserve capacity in outgoing headers map
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-14 02:11:25 -04:00
strawberry
69b2bc4b8c Merge remote-tracking branch 'upstream/main' into conduwuit-changes 2024-08-14 01:47:43 -04:00
strawberry
6bdc5ad326 Revert "optimize for optional static response headers zero-copy zero-alloc"
This reverts commit fd11fee88d937d69f557fa3d6ef09639c7b2e2f7.
2024-08-14 01:46:35 -04:00
strawberry
3174097e35 Revert "estimate and reserve capacity in outgoing headers map"
This reverts commit a6e340e24d570b1d924fff52c68d1dea72946b68.
2024-08-14 01:44:42 -04:00
strawberry
03037f6c92 Revert "Fix assumptions about header value types"
This reverts commit 767b7c72f782b04f8e7c714a152a08699ff8c1ca.
2024-08-14 01:44:16 -04:00
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
Jason Volk
de41ebd92f zero-alloc zero-copy identifier deserialization and validation
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-11 20:37:10 +00:00
Kévin Commaille
f73ba5556c api: Allow types implementing ToString and FromStr for header values
Contrary to what the previous docs said, types implementing Display did not work,
only string types worked.
2024-07-14 12:28:48 +02: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
Benjamin Bouvier
fec2152d87
events: allow deserializing an event content with a type (#1850)
This allows deserializing all the `*EventContent` types into a parent `Any{...}EventContent`, assuming we know the type of the underlying event.

Required for serializing/deserializing the content of events we'd like to send, across application restarts, as in https://github.com/matrix-org/matrix-rust-sdk/issues/3361 for the Rust SDK.

---

* events: add deserialize_with_type to all the *EventContent types

* events: add smoke test for deserializing an event content with a type

* events: add a test for deserializing a secret storage key event content

* events: add fix for correctly matching events with a type fragment

* Address review comments.
2024-06-24 10:55:12 +02: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
00a17dbe9d events: Fix deserialization of AnyGlobalAccountDataEvent for variants with type fragment 2024-06-21 18:10:31 +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
Kévin Commaille
efd0b4f308
Release ruma-macros 0.13.0 2024-05-09 12:11:41 +02:00
Jonas Platte
5e68c93ec8
Upgrade proc-macro-crate from 2.0 to 3.0 2024-04-28 22:52:18 +02:00