mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-27 00:30:17 +08:00
Add docs
This commit is contained in:
parent
fa43f2689c
commit
4c30e3d9d7
@ -12,6 +12,9 @@ import net.mamoe.mirai.console.util.cast
|
|||||||
import net.mamoe.mirai.console.util.safeCast
|
import net.mamoe.mirai.console.util.safeCast
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builtin implementation of [CommandCallResolver]
|
||||||
|
*/
|
||||||
@ConsoleExperimentalApi
|
@ConsoleExperimentalApi
|
||||||
@ExperimentalCommandDescriptors
|
@ExperimentalCommandDescriptors
|
||||||
public object BuiltInCommandCallResolver : CommandCallResolver {
|
public object BuiltInCommandCallResolver : CommandCallResolver {
|
||||||
|
@ -11,9 +11,13 @@ package net.mamoe.mirai.console.command.resolve
|
|||||||
|
|
||||||
import net.mamoe.mirai.console.command.descriptor.ExperimentalCommandDescriptors
|
import net.mamoe.mirai.console.command.descriptor.ExperimentalCommandDescriptors
|
||||||
import net.mamoe.mirai.console.command.parse.CommandCall
|
import net.mamoe.mirai.console.command.parse.CommandCall
|
||||||
|
import net.mamoe.mirai.console.extensions.CommandCallResolverProvider
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The resolver converting a [CommandCall] into [ResolvedCommandCall] based on registered []
|
* The resolver converting a [CommandCall] into [ResolvedCommandCall] based on registered []
|
||||||
|
*
|
||||||
|
* @see CommandCallResolverProvider The provider to instances of this class
|
||||||
|
* @see BuiltInCommandCallResolver The builtin implementation
|
||||||
*/
|
*/
|
||||||
@ExperimentalCommandDescriptors
|
@ExperimentalCommandDescriptors
|
||||||
public interface CommandCallResolver {
|
public interface CommandCallResolver {
|
||||||
|
@ -11,6 +11,10 @@ package net.mamoe.mirai.console.util
|
|||||||
|
|
||||||
import kotlin.contracts.contract
|
import kotlin.contracts.contract
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform `this as? T`.
|
||||||
|
*/
|
||||||
|
@JvmSynthetic
|
||||||
public inline fun <reified T : Any> Any?.safeCast(): T? {
|
public inline fun <reified T : Any> Any?.safeCast(): T? {
|
||||||
contract {
|
contract {
|
||||||
returnsNotNull() implies (this@safeCast is T)
|
returnsNotNull() implies (this@safeCast is T)
|
||||||
@ -18,6 +22,10 @@ public inline fun <reified T : Any> Any?.safeCast(): T? {
|
|||||||
return this as? T
|
return this as? T
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform `this as T`.
|
||||||
|
*/
|
||||||
|
@JvmSynthetic
|
||||||
public inline fun <reified T : Any> Any?.cast(): T {
|
public inline fun <reified T : Any> Any?.cast(): T {
|
||||||
contract {
|
contract {
|
||||||
returns() implies (this@cast is T)
|
returns() implies (this@cast is T)
|
||||||
|
Loading…
Reference in New Issue
Block a user