From: James Sedgwick Date: Thu, 23 Apr 2015 17:44:12 +0000 (-0700) Subject: makeFutureTry -> makeFutureWith X-Git-Tag: v0.36.0~8 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b79405c612523670e6b4238c8ff85681734b7075;p=folly.git makeFutureTry -> makeFutureWith Summary: Similar to Promise::fulfil -> setWith change, this name is a lot clearer Test Plan: tests Reviewed By: hans@fb.com Subscribers: netego-diffs@, fugalh, mwa, jgehring, fuegen, folly-diffs@, tingy, jsedgwick, yfeldblum, chalfant FB internal diff: D2013124 Tasks: 6837405 Signature: t1:2013124:1429735106:e8861925dfeb6d7f0662c1057cbcf2ad8dcf008c --- diff --git a/folly/futures/Future-inl.h b/folly/futures/Future-inl.h index 5604ed06..135440a9 100644 --- a/folly/futures/Future-inl.h +++ b/folly/futures/Future-inl.h @@ -469,7 +469,7 @@ Future makeFuture() { } template -auto makeFutureTry( +auto makeFutureWith( F&& func, typename std::enable_if::value, bool>::type sdf) -> Future { @@ -482,9 +482,9 @@ auto makeFutureTry( } template -auto makeFutureTry(F const& func) -> Future { +auto makeFutureWith(F const& func) -> Future { F copy = func; - return makeFutureTry(std::move(copy)); + return makeFutureWith(std::move(copy)); } template diff --git a/folly/futures/Future.h b/folly/futures/Future.h index 8e2b3f1e..683c3cbb 100644 --- a/folly/futures/Future.h +++ b/folly/futures/Future.h @@ -581,14 +581,14 @@ Future makeFuture(); /** Make a completed Future by executing a function. If the function throws we capture the exception, otherwise we capture the result. */ template -auto makeFutureTry( +auto makeFutureWith( F&& func, typename std::enable_if< !std::is_reference::value, bool>::type sdf = false) -> Future; template -auto makeFutureTry( +auto makeFutureWith( F const& func) -> Future; diff --git a/folly/futures/test/FutureTest.cpp b/folly/futures/test/FutureTest.cpp index ad99f3fd..da3e1c5c 100644 --- a/folly/futures/test/FutureTest.cpp +++ b/folly/futures/test/FutureTest.cpp @@ -536,12 +536,12 @@ TEST(Future, makeFuture) { EXPECT_EQ(42, makeFuture(42).value()); auto fun = [] { return 42; }; - EXPECT_TYPE(makeFutureTry(fun), Future); - EXPECT_EQ(42, makeFutureTry(fun).value()); + EXPECT_TYPE(makeFutureWith(fun), Future); + EXPECT_EQ(42, makeFutureWith(fun).value()); auto failfun = []() -> int { throw eggs; }; - EXPECT_TYPE(makeFutureTry(failfun), Future); - EXPECT_THROW(makeFutureTry(failfun).value(), eggs_t); + EXPECT_TYPE(makeFutureWith(failfun), Future); + EXPECT_THROW(makeFutureWith(failfun).value(), eggs_t); EXPECT_TYPE(makeFuture(), Future); } diff --git a/folly/wangle/channel/test/MockChannelHandler.h b/folly/wangle/channel/test/MockChannelHandler.h index f32fc033..15b88cb7 100644 --- a/folly/wangle/channel/test/MockChannelHandler.h +++ b/folly/wangle/channel/test/MockChannelHandler.h @@ -57,13 +57,13 @@ class MockChannelHandler : public ChannelHandler { } Future write(Context* ctx, Win msg) override { - return makeFutureTry([&](){ + return makeFutureWith([&](){ write_(ctx, msg); }); } Future close(Context* ctx) override { - return makeFutureTry([&](){ + return makeFutureWith([&](){ close_(ctx); }); }