Add simple constructor for TypeSafeMap

This commit is contained in:
Him188 2021-08-16 16:00:38 +08:00
parent f5b2dbc65d
commit f5fe442cc8

View File

@ -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)