mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-24 04:07:47 +00:00
Document Future
This commit is contained in:
1 parent
9bfe893908
commit
da58e228c0
1 file changed
+7
-4
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user