-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StreamSink recursive intodart_type #1843
StreamSink recursive intodart_type #1843
Conversation
Hi! Thanks for opening this pull request! 😄 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1843 +/- ##
=======================================
Coverage 99.27% 99.27%
=======================================
Files 358 359 +1
Lines 15099 15127 +28
=======================================
+ Hits 14989 15017 +28
Misses 110 110 ☔ View full report in Codecov by Sentry. |
Feel free to ping me when ready (or having any questions) :) |
force push after running frb_internal on pure_dart_pde as well
393b960
to
a0e6e7d
Compare
I couldn't get |
Also, while writing this fix, I found that there are also other edge cases with Will probably take a look at them at a later date since I plan to aggressively use |
For that precommit thing, one way may be For the command integrate CI, just manually modify things in https://github.com/fzyzcjy/flutter_rust_bridge/tree/master/frb_codegen/assets/integration_template, because the "integrate" command indeed copy-and-paste things from there to the frb_examples (in order to let end users be fast).
Sure, take your time and looking forward! |
@fzyzcjy, will need some advise here for the Say the user want to use I have verified that things will work fine if we derive the 3 traits like such Hence back to the initial question since we wouldn't want to derive these traits if users are not using |
Interesting! IIRC there may not have been such things. |
I don't think that would work either, for all we know, users may do Another idea I had was to have a blanket implementation for wrapper types, currently wrapper types are concrete types pub struct frb_Wrapper<T>(T)
impl <T: Hash> Hash for frb_Wrapper<T> {
// Delegate hashing to inner type
}
impl IntoIntoDart<frb_Wrapper<OpaqueStruct>> for OpaqueStruct {
// Same implementation on concrete type as before
}
// And other generated impls... |
Yes, then we may need to introduce some kind of
Good idea! I am also not sure whether that will work (IIRC I made a ton of new structs instead of one generic struct because of some reasons, but those reasons may disappear during later refactors, so yes this may work!), thus it would be great to firstly make some lightweight attempts to see whether it breaks something or not. (Should be quite fast, since we are just changing Local_Auto_Something to |
Side note, I did manage to find some way to check whether there is HashSet before emitting the |
This covers cases such as HashSet<>, HashMap<>, Vec<>, Option<>, and fixed array types when being used in StreamSink
Rather than using concrete types that is generated for each type we want to wrap, introduce `frb_wrapper<T>` instead, this helps to propagate traits that we want the wrapper type to auto-implement such as `Eq` and `Hash` so `StreamSink<HashSet<>>` can be used without manual impls on the wrapper types. squashed fix: prefer to use frb_wrapper::from to instantiate This has the benefit where we can just use `self.into()` whenever we are converting from user types to wrapped type
Use proper stack based parsing to find the matching closing angle bracket so that situations like StreamSink<Option<T, SseCodec>> don't happen
Remove leftover imports from testing things around
@fzyzcjy, I think the CI with generate is picking up wrongly on pubspec.lock being changed and failing |
No worries, just run that command ( |
Looks like ci is happy now, currently the pr includes the switch over from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work! Ready to merge and only some quick nits
tools/frb_internal/lib/src/frb_example_pure_dart_generator/rust/entrypoint.dart
Outdated
Show resolved
Hide resolved
frb_example/pure_dart/test/api/pseudo_manual/stream_twin_rust_async_sse_test.dart
Outdated
Show resolved
Hide resolved
frb_codegen/src/library/codegen/generator/wire/rust/spec_generator/misc/mod.rs
Outdated
Show resolved
Hide resolved
frb_codegen/src/library/codegen/parser/type_parser/enum_or_struct.rs
Outdated
Show resolved
Hide resolved
Changed frb_wrapper<T> to FrbWrapper<T> Remove unnecessary function to generate concrete warpper types Remove unnecessary derive on mirror enum in pure_dart example Splitted generic inner type tool function to its own Utilize dart matcher for declarative testing
(no worries about the flaky ios failure) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just one tiny nit and you can choose not to modify it
frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_sync_sse_test.dart
Show resolved
Hide resolved
Hi! Congrats on merging your first pull request! 🎉 |
@all-contributors please add @SilverMira for code |
I've put up a pull request to add @SilverMira! 🎉 |
Changes
Fixes #1839
Checklist
./frb_internal precommit --mode slow
(orfast
) is run (it internal runs code generator, does auto formatting, etc).If this PR adds/changes features, documentations (in the./website
folder) are updated.Remark for PR creator
./frb_internal --help
shows utilities for development.