Document Future

This commit is contained in:
Gwendal Roué committed 2018-09-09 13:18:15 +02:00
1 parent 9bfe893908
commit da58e228c0
1 file changed
+7 -4
+7 -4
View File
@@ -227,14 +227,17 @@ extension DatabaseWriter {
}
}
public struct Future<T> {
private let _wait: () throws -> T
/// A future value.
public struct Future<Value> {
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()
}
}