-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a way to add custom state and update sdk #13
base: main
Are you sure you want to change the base?
Conversation
mrsbfh-macros/src/lib.rs
Outdated
|
||
let mut msg = mrsbfh::commands::Message::new(); | ||
// TODO insert all the things in the function args | ||
msg.extensions_mut().insert(std::sync::Arc::clone(&args)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@donicrosby This is basically where now your wish comes in. I basically need to do this dynamically for all the things that the function provides when you use the macro. This is currently still hardcoded to only do the config. But the example bot should give you an idea how the api will look like. Which means it should be fairly similiar as before with not too many changes needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed the rest now. So in theory this PR should work. It compiles but I didnt actually test if it works in practice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One issue is that mutex stuff needs to already be Arc<Mutex<>>
to work. It should however then clone the arc as required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That shouldn't be too difficult, I think that's fairly standard for something like this.
Thanks for the quick fix! I'll test it out later tonight!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure no problem :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have any bugs feel free to mention them in this PR :) I only ran the example bot as I have no other to test with currently. So there may be stuff i missed
Followup issue: #14 |
Some feedback from jplatte:
|
…o fixed get_mut and remove which were broken.
Main missing TODO is now fixing the comments I think |
This is heavily building upon what http and axum do. In fact there is a lot of reused code.
This allows for function defined like this:
Downsides:
Pros:
Fixes #12
Missing is:
Tests seem to work: