在下面的代码片段中,我看到了这种Unit
类型,但不知道何时使用它以及它在做什么?我读了这个https://github.com/facebook/folly/blob/master/folly/Unit.h但仍然不知道如何在我的程序中使用这个单元。单元将提供哪些帮助的典型场景是什么?
Future<Unit> fut3 = std::move(fut2)
.thenValue([](string str) {
cout << str << endl;
})
.thenTry([](folly::Try<string> strTry) {
cout << strTry.value() << endl;
})
.thenError(folly::tag_t<std::exception>{}, [](std::exception const& e) {
cerr << e.what() << endl;
});