Commit Graph

1075 Commits

Author SHA1 Message Date
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
bitfl0wer 8ca4ba6e50
Change observe() again, pass Arc<RwLock<T>> into message.update(), Add comment explaining closure 2023-08-13 16:46:21 +02:00
bitfl0wer 8de2aee513
Update test to match code changes 2023-08-13 16:44:58 +02:00
bitfl0wer f5d74c57a4
Remove channel_id argument from modify. WHY WAS IT THERE TO BEGIN WITH LOL 2023-08-13 15:54:25 +02:00
bitfl0wer 33d5675cc4
Change tests to deal with `Arc<RwLock<T>>`'s 2023-08-13 15:54:07 +02:00
bitfl0wer 041ee223c3
Moddify observe to still store T internally 2023-08-13 15:52:16 +02:00
fowb 582d855662 Change T: Updateable to Arc<RwLock<T>> 2023-08-12 22:40:40 +02:00
fowb bca1092dd0 Add fixme comment 2023-08-12 22:40:07 +02:00
fowb d28f19d8ca Change observe() to take Arc<RwLock<T>> 2023-08-12 19:47:11 +02:00
fowb b672dd221c Change Mutex<T> to RwLock<T> 2023-08-12 19:31:31 +02:00
fowb 62b3f35fa2 Merge branch 'main' into enhancement/improved-auto-updating-structs 2023-08-12 19:04:25 +02:00
kozabrada123 5faee2cbd1
Fix trailing /s (#180) 2023-08-12 16:48:33 +02:00
kozabrada123 855a4278df
Minor snowflake updates (#179)
* Make snowflake fully public

* Simple into for snowflake
2023-08-07 20:34:58 +02:00
Flori b6ab9d47ad
Fix unwrap panic on trying to access rate limits (#178) 2023-08-07 14:56:32 +02:00
bitfl0wer 207e67396a
Fix unwrap panic on trying to access rate limits 2023-08-07 14:56:10 +02:00
kozabrada123 6d5a1ad295
Minor improvements to message events (#177) 2023-08-07 14:15:23 +02:00
bitfl0wer b2a3294b5d
update mutex to rwlock 2023-08-04 20:08:49 +02:00
bitfl0wer 38a97fc37a
Change Arc<Mutex<T>> components to Arc<RwLock<T>> 2023-08-04 17:57:03 +02:00
bitfl0wer 1eb581c049
Add note about Gateway: store 2023-08-04 16:54:56 +02:00
bitfl0wer 9fe55559c7
Add note about GatewayHandle: `store` 2023-08-04 16:54:03 +02:00
bitfl0wer 1154cc98a1
Make message mut 2023-08-04 16:46:22 +02:00
bitfl0wer 043aaf5e59
Add clone bound to T 2023-08-04 16:46:15 +02:00
bitfl0wer adb5b47bbd
Fix channel.rs 2023-08-04 16:41:57 +02:00
bitfl0wer 9fec38142c
Add update_object 2023-08-04 16:41:51 +02:00
bitfl0wer 2fe95ccc06
Add JsonField derive 2023-08-04 16:41:37 +02:00
Flori a51d524f46
Components and Composites (#175)
As described in #165 , Gateway induced changes of entity structs do not
get propagated to other structs holding the "same" object which got
updated. This is bad because it means that structs still hold
potentially outdated info.

My proposed solution is to create components and composites. A component
is an object with information which is supposed to be the same in at
least 2 structs, such as a Channel object ("channels" field in Guild
struct and lone Channel object for example). These components should be
shared instead of cloned, to make sure that an update to this shared
structs fields is reflected everywhere the struct is being used.

We can do this by using `Arc<Mutex<T>>`. Mutex can be the
std::sync::Mutex, as long as locks on the components themselves are not
being held across .await points. ~~This draft is not yet finished, but~~
all instances of components in composite entity structs have been
replaced with their `Arc<Mutex<T>>` counterparts already.
2023-08-04 15:55:47 +02:00
Flori f74214e181
Merge pull request #1 from kozabrada123/prototype/component-and-composites
Re-add derives to structs where possible
2023-08-04 15:48:34 +02:00
kozabrada123 4d0f27a668 Re-add derives to structs where possible 2023-08-04 15:33:46 +02:00
bitfl0wer 126d411b54
Fix deadlock on test_get_mutual_relationships 2023-08-04 11:42:28 +02:00
bitfl0wer 5926cbb70e
Fix deadlock in test_get_relationships 2023-08-04 11:34:03 +02:00
bitfl0wer 578b4c2fa9
Integrate component behaviour everywhere 2023-08-04 11:19:23 +02:00
bitfl0wer 96213aaf24
Make components be Arc<Mutex<T>> 2023-08-02 23:08:53 +02:00
bitfl0wer 2bfdf4e3e9
Add PartialEq, Eq, Hash to Enums 2023-08-02 20:23:50 +02:00
bitfl0wer 5d66ad83f2
Start component-izing entities, remove PartialEq wherever needed (because PartialEq isn't implemented for Mutex) 2023-08-02 20:18:16 +02:00
bitfl0wer 1bb91251f5
Add rc feature to serde 2023-08-02 20:17:36 +02:00
bitfl0wer 076887938f
Exclude all Target dirs 2023-08-01 21:21:00 +02:00
Flori 80dac3b7a1
Doc comment improvements (#171)
This pr is focused on improving doc comments, along with some minor
changes

Changes (up to now):
- Make all doc comments use `///`
- Fix links (links that aren't actually links, links such as
`[https://discord.com](https://discord.com)` -> `<https://discord.com>`)
- Remove unnecessary docs that only restate what the function signature
already says
- Document some previously undocumented types
- Change `Result<_, crate::errors::ChorusError>` to `ChorusResult<_>`
- Rename `create_guild_invite` to `create_channel_invite` (See the
surrounding code and the endpoint used)

Should close #129
2023-07-31 22:37:23 +02:00
kozabrada123 6cbde1a04b Fix missing references to the best of my ability 2023-07-31 10:28:18 +02:00
kozabrada123 9f39943b15 Goof 2023-07-31 10:07:56 +02:00
kozabrada123 4e4e279333 Docs 2023-07-31 10:01:25 +02:00
kozabrada123 abb3c7e0e6 Merge branch 'main' into fix/doc-improvements 2023-07-31 09:13:33 +02:00
Flori 911dcc5d83
Changed struct reaction (#173)
Fixes #172
2023-07-30 20:35:32 +02:00
Flori 18faea5aad
Remove newline 2023-07-30 20:35:02 +02:00