From da58e228c074192a15161069559fa22f09ded009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 9 Sep 2018 13:18:15 +0200 Subject: [PATCH] Document Future --- GRDB/Core/DatabaseWriter.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/GRDB/Core/DatabaseWriter.swift b/GRDB/Core/DatabaseWriter.swift index 2d5926d9b..bb972f850 100644 --- a/GRDB/Core/DatabaseWriter.swift +++ b/GRDB/Core/DatabaseWriter.swift @@ -227,14 +227,17 @@ extension DatabaseWriter { } } -public struct Future { - private let _wait: () throws -> T +/// A future value. +public struct Future { + private let _wait: () throws -> Value - init(_ wait: @escaping () throws -> T) { + init(_ wait: @escaping () throws -> Value) { _wait = wait } - public func wait() throws -> T { + /// Blocks the current thread until the future value is available. + /// Throws an error if the value could not be computed. + public func wait() throws -> Value { return try _wait() } }