Skip to content

Conversation

mkrasnitski
Copy link

Supersedes #320. Replaces hacky blanket impl {Pop,Slash}Argument for T whenever T: ArgumentConvert and T: FromStr with explicit implementations generated via macro_rules!. One breaking change for PopArgument is that types which do not implement ArgumentConvert but implement FromStr must be decorated with a new #[string] attribute in order to generate the required parsing logic. Either that, or the user must implement the trait manually.

We also keep the current logic for parsing IDs out of @-mentions.

Replaces the specialization of blanket impls with macro-generated impls
for types that explicitly implement `serenity::ArgumentConvert`, and
introduce a new `#[string]` attribute to signal that a type's `FromStr`
implementation should be used.
Replaces hacky blanket impls with macro-generated impls for specific
types, including some types that didn't have impls before, to line up
with the list of types that implement `PopArgument`.
@mkrasnitski
Copy link
Author

Additional clippy failures are unrelated, so this PR is ready for merge.

@arqunis arqunis merged commit 7f265e5 into serenity-rs:next Jul 14, 2025
11 of 12 checks passed
@mkrasnitski mkrasnitski deleted the argument-specialization branch July 19, 2025 12:51
veronoicc pushed a commit to veronoicc/poise that referenced this pull request Oct 7, 2025
…renity-rs#357)

Replaces the specialization of blanket impls with macro-generated impls for
types that explicitly implement `serenity::ArgumentConvert`, and introduce a
new `#[string]` attribute to signal that a type's `FromStr` implementation
should be used.

Also replaces hacky blanket impls with macro-generated impls for specific
types, including some types that did not have impls before, to line up with the
list of types that implement `PopArgument`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants