mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-22 13:46:13 +08:00
Add simple constructor for TypeSafeMap
This commit is contained in:
parent
f5b2dbc65d
commit
f5fe442cc8
@ -113,6 +113,10 @@ public inline fun MutableTypeSafeMap(): MutableTypeSafeMap = MutableTypeSafeMapI
|
||||
public inline fun MutableTypeSafeMap(map: Map<String, Any?>): MutableTypeSafeMap =
|
||||
MutableTypeSafeMapImpl().also { it.map.putAll(map) }
|
||||
|
||||
public inline fun TypeSafeMap(): TypeSafeMap = MutableTypeSafeMapImpl()
|
||||
public inline fun TypeSafeMap(map: Map<String, Any?>): TypeSafeMap =
|
||||
MutableTypeSafeMapImpl().also { it.map.putAll(map) }
|
||||
|
||||
public inline fun buildTypeSafeMap(block: MutableTypeSafeMap.() -> Unit): MutableTypeSafeMap {
|
||||
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
|
||||
return MutableTypeSafeMapImpl().apply(block)
|
||||
|
Loading…
Reference in New Issue
Block a user