refactor(commands): from async to sync Part 3
This commit is contained in:
1 parent
5d841d6d3b
commit
66a5f53408
222 files changed
+11699
-12920
No files matched your search
@@ -27,19 +27,14 @@ impl GetClientSideArgParser for EnchantmentArgumentConsumer {
|
||||
}
|
||||
|
||||
impl ArgumentConsumer for EnchantmentArgumentConsumer {
|
||||
fn consume<'a, 'b>(
|
||||
fn consume<'a>(
|
||||
&'a self,
|
||||
_sender: &'a CommandSender,
|
||||
_server: &'a Server,
|
||||
args: &'b mut RawArgs<'a>,
|
||||
args: &mut RawArgs<'a>,
|
||||
) -> ConsumeResult<'a> {
|
||||
let name_opt: Option<&'a str> = args.pop().map(|arg| arg.value);
|
||||
|
||||
let result: Option<Arg<'a>> = name_opt.map_or_else(
|
||||
|| None,
|
||||
|name| Enchantment::from_name(name).map(Arg::Enchantment),
|
||||
);
|
||||
Box::pin(async move { result })
|
||||
let name = args.pop().map(|arg| arg.value)?;
|
||||
Enchantment::from_name(name).map(Arg::Enchantment)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user