Move create_request_promise implementation to header for SplitSource.

This commit is contained in:
levlam 2024-08-15 10:45:34 +03:00
parent 7664383813
commit 980aa4bd22
2 changed files with 9 additions and 12 deletions

View File

@ -2176,17 +2176,6 @@ void Requests::answer_ok_query(uint64 id, Status status) {
}
}
template <class T>
Promise<T> Requests::create_request_promise(uint64 id) {
return PromiseCreator::lambda([actor_id = td_actor_, id](Result<T> r_state) {
if (r_state.is_error()) {
send_closure(actor_id, &Td::send_error, id, r_state.move_as_error());
} else {
send_closure(actor_id, &Td::send_result, id, r_state.move_as_ok());
}
});
}
Promise<Unit> Requests::create_ok_request_promise(uint64 id) {
return PromiseCreator::lambda([actor_id = td_actor_, id](Result<Unit> result) {
if (result.is_error()) {

View File

@ -54,7 +54,15 @@ class Requests {
std::shared_ptr<UploadFileCallback> upload_file_callback_;
template <class T>
Promise<T> create_request_promise(uint64 id);
Promise<T> create_request_promise(uint64 id) {
return PromiseCreator::lambda([actor_id = td_actor_, id](Result<T> r_state) {
if (r_state.is_error()) {
send_closure(actor_id, &Td::send_error, id, r_state.move_as_error());
} else {
send_closure(actor_id, &Td::send_result, id, r_state.move_as_ok());
}
});
}
Promise<Unit> create_ok_request_promise(uint64 id);