Closed Roms1383 closed 2 years ago
Leaving link to experiment in the playground as a reminder, mostly to myself ^^
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 ?
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 :
Uint8List
into chunks.
offset
parameter in UuidValue.fromByteList.offset
can be used in UuidValue.fromByteList
, but the buffer has to be of length 16)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 ?
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.
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.
I think it's ready for review 👌
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!
Thanks Shady, no worries ! We're almost good downstream too ^^
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 forchrono
types is almost finished but not quite yet).