mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-08 19:54:44 +08:00
Add TypeSafeMap.toMutableTypeSafeMap
This commit is contained in:
parent
e202149c3a
commit
0711b5ae2e
@ -121,6 +121,8 @@ internal class MutableTypeSafeMapImpl(
|
||||
override fun <T> remove(key: TypeKey<T>): T? = map.remove(key.name)?.uncheckedCast()
|
||||
}
|
||||
|
||||
public fun TypeSafeMap.toMutableTypeSafeMap(): MutableTypeSafeMap = MutableTypeSafeMap(this.toMap())
|
||||
|
||||
public inline fun MutableTypeSafeMap(): MutableTypeSafeMap = MutableTypeSafeMapImpl()
|
||||
public inline fun MutableTypeSafeMap(map: Map<String, Any?>): MutableTypeSafeMap =
|
||||
MutableTypeSafeMapImpl().also { it.map.putAll(map) }
|
||||
|
Loading…
Reference in New Issue
Block a user