Commit c4b348c3 authored by Hans Fugal's avatar Hans Fugal Committed by Dave Watson

s/valueTry/getTry/

Summary: This is a better name

Test Plan: unit tests. fbgs shows no external usage of this.

Reviewed By: hannesr@fb.com

FB internal diff: D1184905
parent 70fb1baf
...@@ -178,10 +178,10 @@ typename std::add_lvalue_reference<const T>::type Future<T>::value() const { ...@@ -178,10 +178,10 @@ typename std::add_lvalue_reference<const T>::type Future<T>::value() const {
} }
template <class T> template <class T>
Try<T>& Future<T>::valueTry() { Try<T>& Future<T>::getTry() {
throwIfInvalid(); throwIfInvalid();
return obj_->valueTry(); return obj_->getTry();
} }
template <class T> template <class T>
......
...@@ -79,7 +79,8 @@ class Future { ...@@ -79,7 +79,8 @@ class Future {
when this returns true. */ when this returns true. */
bool isReady() const; bool isReady() const;
Try<T>& valueTry(); /** A reference to the Try of the value */
Try<T>& getTry();
/** When this Future has completed, execute func which is a function that /** When this Future has completed, execute func which is a function that
takes a Try<T>&&. A Future for the return type of func is takes a Try<T>&&. A Future for the return type of func is
......
...@@ -40,7 +40,7 @@ class FutureObject { ...@@ -40,7 +40,7 @@ class FutureObject {
FutureObject(FutureObject&&) = delete; FutureObject(FutureObject&&) = delete;
FutureObject& operator=(FutureObject&&) = delete; FutureObject& operator=(FutureObject&&) = delete;
Try<T>& valueTry() { Try<T>& getTry() {
return *value_; return *value_;
} }
......
...@@ -108,13 +108,13 @@ TEST(Future, isReady) { ...@@ -108,13 +108,13 @@ TEST(Future, isReady) {
} }
TEST(Future, hasException) { TEST(Future, hasException) {
EXPECT_TRUE(makeFuture<int>(eggs).valueTry().hasException()); EXPECT_TRUE(makeFuture<int>(eggs).getTry().hasException());
EXPECT_FALSE(makeFuture(42).valueTry().hasException()); EXPECT_FALSE(makeFuture(42).getTry().hasException());
} }
TEST(Future, hasValue) { TEST(Future, hasValue) {
EXPECT_TRUE(makeFuture(42).valueTry().hasValue()); EXPECT_TRUE(makeFuture(42).getTry().hasValue());
EXPECT_FALSE(makeFuture<int>(eggs).valueTry().hasValue()); EXPECT_FALSE(makeFuture<int>(eggs).getTry().hasValue());
} }
TEST(Future, makeFuture) { TEST(Future, makeFuture) {
...@@ -329,7 +329,7 @@ TEST(Future, whenAll) { ...@@ -329,7 +329,7 @@ TEST(Future, whenAll) {
promises[3].setException(eggs); promises[3].setException(eggs);
EXPECT_TRUE(allf.isReady()); EXPECT_TRUE(allf.isReady());
EXPECT_FALSE(allf.valueTry().hasException()); EXPECT_FALSE(allf.getTry().hasException());
auto& results = allf.value(); auto& results = allf.value();
EXPECT_EQ(42, results[0].value()); EXPECT_EQ(42, results[0].value());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment