-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v0.2.2 release
- Loading branch information
Showing
6 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
core/src/jvmMain/kotlin/com/huanshankeji/collections/Collections.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.huanshankeji.collections | ||
|
||
fun List<*>.areElementsDistinct() = | ||
// There is a more efficient implementation. | ||
distinct().size == size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
vertx/src/main/kotlin/com/huanshankeji/vertx/kotlin/coroutines/ext/web/CoroutineHandlers.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.huanshankeji.vertx.kotlin.coroutines.ext.web | ||
|
||
import com.huanshankeji.vertx.ext.web.checkedRun | ||
import io.vertx.ext.web.Route | ||
import io.vertx.ext.web.RoutingContext | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.launch | ||
|
||
// workaround for context receivers | ||
fun coroutineHandler( | ||
coroutineScope: CoroutineScope, route: Route, | ||
requestHandler: suspend (RoutingContext) -> Unit | ||
): Route = | ||
route.handler { coroutineScope.launch { requestHandler(it) } } | ||
|
||
// workaround for context receivers | ||
fun checkedCoroutineHandler( | ||
coroutineScope: CoroutineScope, route: Route, | ||
requestHandler: suspend (RoutingContext) -> Unit | ||
): Route = | ||
coroutineHandler(coroutineScope, route) { ctx -> ctx.checkedRun { requestHandler(ctx) } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters