[swift-server-dev] Next HTTP API meeting
Michael Chiu
hatsuneyuji at icloud.com
Mon Mar 27 16:16:57 CDT 2017
I tried the following code and it build and run.
struct EmptyStruct {}
func test(closure: @escaping (inout EmptyStruct) -> () ) {
var foo = EmptyStruct()
closure(&foo)
}
Michael
> On Mar 27, 2017, at 2:08 PM, Sergo Beruashvili via swift-server-dev <swift-server-dev at swift.org> wrote:
>
> Hello everyone,
>
> I think we are missing something here,
> If we use struct for Request/Response, this means we cannot use them in @escaping closures.
>
> Most of requests end up reading from a database ( redis, mysql/postgre... ) or maybe even from a network.
> Proper way of reading from those sources would be using DispatchIO ( or similar technique ) , which does not block the current execution, but reads the data and calls your @escaping closure once its done.
> Swift closures can't capture inout structs.
>
> Regards,
> Sergo
More information about the swift-server-dev
mailing list