feat add Async interface

This commit is contained in:
tqcq 2024-04-19 19:07:42 +08:00
parent 07b790557b
commit f5fb87ce85
2 changed files with 2 additions and 2 deletions

View File

@ -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; });
}

View File

@ -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");
}
}