Page MenuHomePhabricator

D9269.diff
No OneTemporary

D9269.diff

diff --git a/native/native_rust_library/RustCallback.h b/native/native_rust_library/RustCallback.h
--- a/native/native_rust_library/RustCallback.h
+++ b/native/native_rust_library/RustCallback.h
@@ -5,5 +5,6 @@
namespace comm {
void stringCallback(rust::String error, uint32_t promiseID, rust::String ret);
+void voidCallback(rust::String error, uint32_t promiseID);
} // namespace comm
diff --git a/native/native_rust_library/RustCallback.cpp b/native/native_rust_library/RustCallback.cpp
--- a/native/native_rust_library/RustCallback.cpp
+++ b/native/native_rust_library/RustCallback.cpp
@@ -23,4 +23,17 @@
}
}
+void voidCallback(rust::String error, uint32_t promiseID) {
+ auto it = RustPromiseManager::instance.promises.find(promiseID);
+ if (it == RustPromiseManager::instance.promises.end()) {
+ return;
+ }
+
+ if (error.size()) {
+ RustPromiseManager::instance.rejectPromise(promiseID, std::string(error));
+ } else {
+ RustPromiseManager::instance.resolvePromise(promiseID, folly::dynamic());
+ }
+}
+
} // namespace comm

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 2, 1:23 AM (7 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2606418
Default Alt Text
D9269.diff (1 KB)

Event Timeline