Trait jupiter::commands::ResultExt

source ·
pub trait ResultExt {
    // Required method
    fn complete(self, call: Call);
}
Expand description

Provides an extension trait on CommandResult so that complete can be directly invoked on it. This reduces some boilerplate as:

let result = my_command(&mut call);
call.complete(result);

becomes:

my_command(&mut call).complete(call)

Note that this has be be defined as trait so that we can “attach” it to CommandResult which is internally a normal Rust Result. Note that the ResultExt trait has to be visible (used) so that the compiler permits to invoke this method.

Required Methods§

source

fn complete(self, call: Call)

Completes the given call with the wrapped result.

This is equivalent to call.complete(self) but more compact to write.

Implementors§