Skip to content
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

Feat/UUID #30

Merged
merged 25 commits into from
Sep 23, 2022
Merged

Feat/UUID #30

merged 25 commits into from
Sep 23, 2022

Conversation

Roms1383
Copy link
Contributor

@Roms1383 Roms1383 commented Sep 21, 2022

In the same fashion, this PR adds support for uuid crate, since it's widely used in app and web alike.
I'm gonna keep as Draft until it's implemented downstream on flutter_rust_bridge (please hold on for a while, previous PR for chrono types is almost finished but not quite yet).

@Roms1383
Copy link
Contributor Author

Leaving link to experiment in the playground as a reminder, mostly to myself ^^

@Roms1383
Copy link
Contributor Author

Also, something I'm not familiar in FFI / Rust / Dart contexts is if endianness matters or if this is already taken care of. So, should I explicitly settle on little or big endian, and if yes, which one would you recommend ?

@Roms1383
Copy link
Contributor Author

Roms1383 commented Sep 21, 2022

What is interesting is that we can also "pack" a Vec<uuid::Uuid> into a single Vec<u8> and be able to reconstruct it on both sides :

@Roms1383
Copy link
Contributor Author

Also, something I'm not familiar in FFI / Rust / Dart contexts is if endianness matters or if this is already taken care of. So, should I explicitly settle on little or big endian, and if yes, which one would you recommend ?

I could also adjust to the system, using Endianness on Dart side and cpu_endian on Rust side, what do you think ?

@shekohex
Copy link
Owner

Also, something I'm not familiar in FFI / Rust / Dart contexts is if endianness matters or if this is already taken care of. So, should I explicitly settle on little or big endian, and if yes, which one would you recommend ?

I could also adjust to the system, using Endianness on Dart side and cpu_endian on Rust side, what do you think ?

I do think it does not matter that much, you better stick with just one on both sides, the other option is use the native endianness (in rust you use *_to_ne_bytes() for example). Nonetheless, you will declare it in the docs and with an example too.

@Roms1383
Copy link
Contributor Author

I do think it does not matter that much, you better stick with just one on both sides, the other option is use the native endianness (in rust you use *_to_ne_bytes() for example). Nonetheless, you will declare it in the docs and with an example too.

I made a quick bench locally to check whether there's a big delta in performance when using native endianness and it doesn't seem to make any notable difference (~2%). I cannot test on different machines with different endianness so I guess you're right, it can probably be ignored.

@Roms1383 Roms1383 marked this pull request as ready for review September 22, 2022 10:01
@Roms1383
Copy link
Contributor Author

I think it's ready for review 👌

shekohex
shekohex previously approved these changes Sep 22, 2022
Copy link
Owner

@shekohex shekohex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@shekohex
Copy link
Owner

There will be a bit of delay to publish this version now on crates.io since I'm on Mobile right now, but once I've my laptop I will issue a new release.

Thank you!

@Roms1383
Copy link
Contributor Author

Thanks Shady, no worries !
We're almost good downstream too ^^

src/uuid.rs Outdated Show resolved Hide resolved
@shekohex shekohex merged commit 4f87449 into shekohex:master Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants