Flori
7828ad2082
Change bearer_auth to header("Authorization" ( #185 )
...
Closes #181
2023-08-17 22:42:12 +02:00
bitfl0wer
9cdc807651
Change bearer_auth to header("Authorization"
2023-08-17 22:26:07 +02:00
Flori
071cee9f2a
Improved auto updating structs ( #184 )
...
This PR does the following things:
- Give `UserMeta` a `GatewayHandle`
- Change struct-fields which are supposed to be "shared" to
`Arc<RwLock<T>>`. "shared" struct-fields are things like a `Channel`
object, which may exist both on their own, and inside a `Guild`s struct
fields. Due to sharing this field, we only need to update a single
object to propagate the changes everywhere.
- Some light refactorings across the project. Example: change
`UserMeta::get()` to `UserMeta::get_user()`
- Add `Composite` trait and proc macro. `Composites` are `Updateable`
(uniquely identifiable) objects, which contain at least one other shared
(`Arc<RwLock<T>>`) field. This trait/macro provides functionality to not
only watch an object, but also all observable struct fields in that
object.
- Gets rid of tokio:⌚ :channel in favor of Arc<RwLock<T>>
To-do before merging:
- [x] Properly test `Composite` functionality to ensure it works as
intended
I'd love a second pair of eyes over this, especially in case I forgot
something major ^^'
2023-08-17 19:40:47 +02:00
bitfl0wer
f047802350
Remove comment
2023-08-17 18:26:34 +02:00
bitfl0wer
ad4404fb43
Remove prints
2023-08-17 18:26:14 +02:00
bitfl0wer
b768d0f444
Call watch_whole either way
2023-08-17 18:26:06 +02:00
bitfl0wer
027a07cd12
Update test a little
2023-08-17 18:23:57 +02:00
bitfl0wer
ebe307aa33
Remove debug prints
2023-08-16 22:04:43 +02:00
bitfl0wer
ef7261adf9
I think i found out why shit no work
2023-08-16 22:04:36 +02:00
bitfl0wer
c2e7a0bed7
Rewrite recursive update test (still fails sob)
2023-08-16 22:04:24 +02:00
bitfl0wer
99bdf819a8
Make store pub(crate), other adjustments
2023-08-16 22:04:07 +02:00
bitfl0wer
b1d8e40ddd
Make trait Debug
2023-08-16 21:26:27 +02:00
bitfl0wer
cc44e77bcc
Remove tokio watch channels
2023-08-16 21:26:19 +02:00
bitfl0wer
c9d9e77f16
Add recursive-updating-structs test
2023-08-16 14:06:04 +02:00
bitfl0wer
7147ac5daf
Rename update to modify
2023-08-16 14:05:51 +02:00
bitfl0wer
9559b15b8a
Make Role Clone
2023-08-16 14:05:44 +02:00
bitfl0wer
8a925631ee
Add GuildRoleCreate and -Update
2023-08-16 14:05:37 +02:00
bitfl0wer
c5cfa9ba19
Remove import
2023-08-16 01:11:48 +02:00
bitfl0wer
93c9f669de
Refactor test
2023-08-16 01:11:32 +02:00
bitfl0wer
eac86b18cd
Rename functions, add observe_and_into_inner
2023-08-16 01:11:26 +02:00
bitfl0wer
497fd56ab0
Revert "Give `GatewayHandle` and `Gateway` common trait to call `watch_whole()` or observe() from a `Gateway`"
...
This reverts commit 8e2e0d137d
.
2023-08-16 00:21:18 +02:00
bitfl0wer
10c3936514
Merge branch 'enhancement/improved-auto-updating-structs' of https://github.com/polyphony-chat/chorus into enhancement/improved-auto-updating-structs
2023-08-16 00:18:36 +02:00
bitfl0wer
8e2e0d137d
Give `GatewayHandle` and `Gateway` common trait to call `watch_whole()` or observe() from a `Gateway`
2023-08-16 00:18:32 +02:00
bitfl0wer
5ffd9074cb
Give `GatewayHandle` and `Gateway` common trait to call `watch_whole()` or observe() from a `Gateway`
2023-08-15 23:41:42 +02:00
bitfl0wer
7fdbe38843
Add back set_json. No idea when it disappeared?
2023-08-15 22:19:47 +02:00
bitfl0wer
9dc86615a4
Merge branch 'feature/update-message-all-events' into enhancement/improved-auto-updating-structs
2023-08-15 20:53:56 +02:00
bitfl0wer
632f633e0c
Remove unused import
2023-08-15 20:30:30 +02:00
bitfl0wer
a48850a241
Clean up test
2023-08-15 20:20:58 +02:00
bitfl0wer
475d285715
Add `Composite` derive to all entities which require it
2023-08-15 20:19:52 +02:00
bitfl0wer
170b3ca8bd
Add `Composite<T>` bound to automatically call `watch_whole()` on caller object.
2023-08-15 20:19:16 +02:00
bitfl0wer
546f925e06
Remove `Send` bound
2023-08-15 20:18:11 +02:00
bitfl0wer
38e661075f
Try calling new method to see if it panics
2023-08-15 17:54:48 +02:00
bitfl0wer
86e8edde27
Make trait pub
2023-08-15 17:54:36 +02:00
bitfl0wer
a1a99aff8d
Add Composite to some types
2023-08-15 17:38:53 +02:00
bitfl0wer
7a21154726
Remove superfluous nesting
2023-08-15 17:08:27 +02:00
bitfl0wer
d30542c783
Implement trait methods
2023-08-15 16:58:20 +02:00
bitfl0wer
69c8b8d076
Try out new macro
2023-08-15 16:58:06 +02:00
bitfl0wer
ec20258abe
Add observe_and_get method
2023-08-15 16:57:54 +02:00
bitfl0wer
d819f6e973
Use async trait where needed
2023-08-15 16:57:35 +02:00
bitfl0wer
02eacf65f6
Add async-trait
2023-08-15 16:57:08 +02:00
bitfl0wer
01c572b6f4
Update syn dependency
2023-08-15 12:36:53 +02:00
bitfl0wer
f9b9efffa4
todo
2023-08-15 12:14:03 +02:00
bitfl0wer
316d02b72b
Add macro and attributes for automatic watching of Composite structs and their components
2023-08-15 12:13:49 +02:00
bitfl0wer
05baec3820
derive Updateable for Guild
2023-08-14 17:18:53 +02:00
bitfl0wer
ab21dbb90a
Add Composite trait
2023-08-14 17:18:44 +02:00
bitfl0wer
71b1839250
Remove unused import
2023-08-14 00:04:58 +02:00
bitfl0wer
68868e7d35
Remove stupid comment from me
2023-08-14 00:04:53 +02:00
bitfl0wer
f0f47315a1
Rename get to get_user
2023-08-14 00:02:30 +02:00
bitfl0wer
888a86903b
Change UserMeta::get() to take self instead of Self
2023-08-14 00:02:03 +02:00
bitfl0wer
9ce575944c
Change UpdateMessage<T> to write into RwLock
2023-08-13 16:46:57 +02:00