Add expression functions with context boundaries
This commit is contained in:
parent
5085ae51aa
commit
773c34f3f4
18 changed files with 391 additions and 52 deletions
12
examples/http_context.gt
Normal file
12
examples/http_context.gt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package main
|
||||
|
||||
import fmt
|
||||
import http net.http
|
||||
|
||||
fun handle(request: *http.Request) = withContext(request.context()) {
|
||||
fmt.println(coroutineContext())
|
||||
}
|
||||
|
||||
fun main() {
|
||||
println("HTTP handlers can establish their request context with withContext")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue