Page MenuHomePhabricator

[NativeRustLibrary] support `std::promise`
ClosedPublic

Authored by kamil on Jan 11 2024, 10:04 AM.
Tags
None
Referenced Files
F2169342: D10613.diff
Tue, Jul 2, 11:13 AM
Unknown Object (File)
Sun, Jun 30, 11:15 PM
Unknown Object (File)
Fri, Jun 14, 10:15 PM
Unknown Object (File)
Mon, Jun 3, 5:04 AM
Unknown Object (File)
May 20 2024, 4:22 PM
Unknown Object (File)
May 20 2024, 4:22 PM
Unknown Object (File)
May 20 2024, 4:22 PM
Unknown Object (File)
May 20 2024, 4:21 PM
Subscribers

Details

Summary

Context in ENG-6384

I tried to implement it using the template (std::promise<T>) but this complicates the code. I think we can assume the caller will handle it properly.

Test Plan
  1. Test both rejecting/resolving
  2. I used one of existing methods and added sleep in Rust code to wait long enough and make sure it works

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil held this revision as a draft.
kamil retitled this revision from [NativeRustModule] support `std::promise` to [NativeRustLibrary] support `std::promise`.
kamil published this revision for review.Jan 11 2024, 10:33 AM
varun requested changes to this revision.Jan 12 2024, 11:58 AM

you tested that both promise types work?

native/cpp/CommonCpp/NativeModules/InternalModules/RustPromiseManager.cpp
47–49 ↗(On Diff #35556)

i introduced this code originally but it looks wrong to me now. we probably shouldn't be adding JSI promises to promises if the jsInvoker is missing

This revision now requires changes to proceed.Jan 12 2024, 11:58 AM
native/cpp/CommonCpp/NativeModules/InternalModules/RustPromiseManager.cpp
8 ↗(On Diff #35556)

Can you explain what’s going on with the formatting changes?

native/cpp/CommonCpp/NativeModules/InternalModules/RustPromiseManager.cpp
8 ↗(On Diff #35556)

This is consistent with CommConstants.cpp (which was introduced afterwards, but uses the better style IMO)

native/cpp/CommonCpp/NativeModules/InternalModules/RustPromiseManager.cpp
8 ↗(On Diff #35556)

Shouldn't the style be set by clang-format?

you tested that both promise types work?

yes, in D10631 where we use both, C++ for prekey rotation and JSI to log in to Identity (D10327)

native/cpp/CommonCpp/NativeModules/InternalModules/RustPromiseManager.cpp
8 ↗(On Diff #35556)

I manually ran clang-format so now it is, not sure why previously it wasn't (it should have been formatted last time the file was committed)

47–49 ↗(On Diff #35556)

fixed

This revision is now accepted and ready to land.Jan 15 2024, 12:08 PM
This revision was automatically updated to reflect the committed changes.