mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
updated smartcontracts
- updated smartcontracts - updated fullnode database layout - fixed memory leak in blockchain-explorer - updated tonlib
This commit is contained in:
parent
9c9248a9ae
commit
c860ce3d1e
104 changed files with 7309 additions and 1335 deletions
|
@ -225,6 +225,7 @@ class Promise {
|
|||
promise_->set_error(std::move(error));
|
||||
promise_.reset();
|
||||
}
|
||||
|
||||
void set_result(Result<T> &&result) {
|
||||
if (!promise_) {
|
||||
return;
|
||||
|
@ -260,6 +261,28 @@ class Promise {
|
|||
explicit operator bool() {
|
||||
return static_cast<bool>(promise_);
|
||||
}
|
||||
template <class V, class F>
|
||||
auto do_wrap(V &&value, F &&func) {
|
||||
if (value.is_ok()) {
|
||||
set_result(func(value.move_as_ok()));
|
||||
} else {
|
||||
set_error(value.move_as_error());
|
||||
}
|
||||
}
|
||||
|
||||
template <class F>
|
||||
auto do_wrap(td::Status status, F &&func) {
|
||||
set_error(std::move(status));
|
||||
}
|
||||
|
||||
template <class F>
|
||||
auto wrap(F &&func) {
|
||||
return [promise = std::move(*this), func = std::move(func)](auto &&res) mutable {
|
||||
promise.do_wrap(std::move(res), std::move(func));
|
||||
};
|
||||
}
|
||||
template <class... ArgsT>
|
||||
auto send_closure(ArgsT &&... args);
|
||||
|
||||
private:
|
||||
std::unique_ptr<PromiseInterface<T>> promise_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue