feat add Async interface
This commit is contained in:
parent
07b790557b
commit
f5fb87ce85
@ -346,7 +346,7 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
static Future<T, FailureT> AsyncWithValue(const T &value) noexcept
|
||||
static Future<T, FailureT> AsyncValue(const T &value) noexcept
|
||||
{
|
||||
return Async([value]() { return value; });
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ TEST_SUITE("future")
|
||||
return 1;
|
||||
});
|
||||
CHECK_FALSE(f2.IsFailed());
|
||||
auto f3 = sled::Future<std::string>::AsyncWithValue("11");
|
||||
auto f3 = sled::Future<std::string>::AsyncValue("11");
|
||||
CHECK_EQ(f3.Result(), "11");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user