Skip to content
This repository was archived by the owner on Jan 20, 2023. It is now read-only.

Commit 6ee552e

Browse files
committed
初期化周りの説明を詳細化
1 parent 738969b commit 6ee552e

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

README.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,22 @@ Please see here for the introduction method.
8888

8989
## How to use FastKFunction
9090

91-
### Instance parameter
92-
If you call an instance function, you can expect a faster call with `instance parameter`.
93-
94-
```kotlin
95-
data class Sample(
96-
val arg1: Int,
97-
val arg2: Int
98-
) {
99-
fun instanceFun(arg3: Int): Int = arg1 + arg2 + arg3
100-
}
101-
102-
val sample = Sample(1, 2)
103-
104-
val fastKFunction = FastKFunction.of(sample::instanceFun, sample)
105-
```
106-
107-
Depending on how you get the `KFunction`, the `instance parameter` may be required.
108-
Even if the `instance parameter` is not required, passing an `instance parameter` will make the call faster.
91+
### Initialization
92+
In some cases, `instance parameter` is required to initialize `FastKFunction`.
93+
Even if the `instance parameter` is not required, passing it may speed up the process.
94+
95+
The following is the correspondence table.
96+
97+
| | instance parameter | description |
98+
|:-----------------------------------:|:------------------:|------------------------------------------------------------|
99+
| **Constructor** | Unnecessary | |
100+
| **Top level function** | Unnecessary | |
101+
| **Method reference from instance** | Optional | Passing the `instance parameter` will speed up the call. |
102+
| **Function defined for the object** | Optional | Passing `instance parameter` will speed up initialization. |
103+
| **Top level extension function** | Required | |
104+
| **Method reference from class** | Required | |
105+
106+
Calling the `constructor` of an `inner class` or an `extension function` defined in an `instance` is currently not supported.
109107

110108
### How to call
111109
`FastKFunction` supports two major types of calls.

0 commit comments

Comments
 (0)