KT-3557: with() made it to stdlib
This commit is contained in:
@@ -51,3 +51,8 @@ public inline fun <A,B> A.to(that: B): Pair<A, B> = Pair(this, that)
|
||||
Run function f
|
||||
*/
|
||||
public inline fun <T> run(f: () -> T) : T = f()
|
||||
|
||||
/**
|
||||
* Execute f with given receiver
|
||||
*/
|
||||
public inline fun <T, R> with(receiver: T, f: T.() -> R) : R = receiver.f()
|
||||
|
||||
Reference in New Issue
Block a user