Unify documentation for scope functions.
This commit is contained in:
@@ -9,23 +9,26 @@ package kotlin
|
||||
public fun <A, B> A.to(that: B): Pair<A, B> = Pair(this, that)
|
||||
|
||||
/**
|
||||
* Calls the specified function.
|
||||
* Calls the specified function [f] and returns its result.
|
||||
*/
|
||||
public inline fun <R> run(f: () -> R): R = f()
|
||||
|
||||
/**
|
||||
* Calls the specified function with this value as its receiver.
|
||||
* Calls the specified function [f] with `this` value as its receiver and returns its result.
|
||||
*/
|
||||
public inline fun <T, R> T.run(f: T.() -> R): R = f()
|
||||
|
||||
/**
|
||||
* Execute f with given receiver
|
||||
* Calls the specified function [f] with the given [receiver] as its receiver and returns its result.
|
||||
*/
|
||||
public inline fun <T, R> with(receiver: T, f: T.() -> R): R = receiver.f()
|
||||
|
||||
/**
|
||||
* Calls the specified function [f] with `this` value as its receiver and returns `this` value.
|
||||
*/
|
||||
public inline fun <T> T.apply(f: T.() -> Unit): T { f(); return this }
|
||||
|
||||
/**
|
||||
* Converts receiver to body parameter
|
||||
* Calls the specified function [f] with `this` value as its argument and returns its result.
|
||||
*/
|
||||
public inline fun <T, R> T.let(f: (T) -> R): R = f(this)
|
||||
|
||||
Reference in New Issue
Block a user