Skip to content
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

Abstract CommandResult type #934

Merged
merged 1 commit into from
Aug 20, 2020
Merged

Conversation

kingbri1
Copy link
Contributor

As discussed in Discord, this allows users to provide an optional type to return on success for CommandResult.

CommandResult currently hardcodes to returning a Result with type ().

Doing this limits the usability of CommandResult since users can't
use this type alias with functions that return Results that don't use
type ().

Since Rust has type defaults, abstract CommandResult to accept type T
with a default type of () which doesn't compromise the existing usage
of CommandResult, but adds onto it.

Signed-off-by: kingbri <bdashore3@gmail.com>
@arqunis arqunis added enhancement An improvement to Serenity. framework Related to the `framework` and `framework::standard` modules and/or the `command_attr` crate labels Aug 20, 2020
@arqunis arqunis merged commit cfbd0be into serenity-rs:current Aug 20, 2020
arqunis pushed a commit to arqunis/serenity that referenced this pull request Nov 9, 2020
CommandResult currently hardcodes to returning a Result with type ().

Doing this limits the usability of CommandResult since users can't
use this type alias with functions that return Results that don't use
type ().

Since Rust has type defaults, abstract CommandResult to accept type T
with a default type of () which doesn't compromise the existing usage
of CommandResult, but adds onto it.

Signed-off-by: kingbri <bdashore3@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement to Serenity. framework Related to the `framework` and `framework::standard` modules and/or the `command_attr` crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants