Remove Promise operators.
This commit is contained in:
parent
cb694ab649
commit
da2e504566
@ -32,6 +32,7 @@ class PromiseInterface {
|
||||
PromiseInterface(PromiseInterface &&) = default;
|
||||
PromiseInterface &operator=(PromiseInterface &&) = default;
|
||||
virtual ~PromiseInterface() = default;
|
||||
|
||||
virtual void set_value(T &&value) {
|
||||
set_result(std::move(value));
|
||||
}
|
||||
@ -45,15 +46,7 @@ class PromiseInterface {
|
||||
set_error(result.move_as_error());
|
||||
}
|
||||
}
|
||||
void operator()(T &&value) {
|
||||
set_value(std::move(value));
|
||||
}
|
||||
void operator()(Status &&error) {
|
||||
set_error(std::move(error));
|
||||
}
|
||||
void operator()(Result<T> &&result) {
|
||||
set_result(std::move(result));
|
||||
}
|
||||
|
||||
virtual bool is_cancellable() const {
|
||||
return false;
|
||||
}
|
||||
@ -220,14 +213,6 @@ class Promise {
|
||||
promise_->set_result(std::move(result));
|
||||
promise_.reset();
|
||||
}
|
||||
template <class S>
|
||||
void operator()(S &&result) {
|
||||
if (!promise_) {
|
||||
return;
|
||||
}
|
||||
promise_->operator()(std::forward<S>(result));
|
||||
promise_.reset();
|
||||
}
|
||||
void reset() {
|
||||
promise_.reset();
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ class Task : public TestClient::Listener {
|
||||
void on_update(std::shared_ptr<TestClient::Update> update) override {
|
||||
auto it = sent_queries_.find(update->id);
|
||||
if (it != sent_queries_.end()) {
|
||||
it->second(std::move(update->object));
|
||||
it->second.set_value(std::move(update->object));
|
||||
sent_queries_.erase(it);
|
||||
}
|
||||
process_update(update);
|
||||
|
Loading…
Reference in New Issue
Block a user