Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3397324
D9269.id31411.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D9269.id31411.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 2, 5:15 PM (21 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2606418
Default Alt Text
D9269.id31411.diff (1 KB)
Attached To
Mode
D9269: [native] helper functions for resolving JS promises with void
Attached
Detach File
Event Timeline
Log In to Comment