On Mon, 2016-04-25 at 16:18 +0200, Jeff Burdges wrote: > As a first task, we should worry about doing the GNUnet style wire > formats nicely, including endiannes. It appears gnunet-rs does not do > this so well right now, so maybe much needs to change.
There are several ways to handle eandianness : First, there is a library for doing the conversion that meshes with some other io libraries. It's unclear if (a) it requires converting the whole struct, or if that's undesirable, or (b) if it meshes well with how we want to do io. https://github.com/BurntSushi/byteorder Second, we Florian pointed out that single element tuple structs act like newtypes in Haskell : https://aturon.github.io/features/types/newtype.html I believe they use the original type's representation, making them usable in our structs. I suppose this might be the route assuming we want piecemeal conversions. You could probably create a NetworkByteOrder<T> that lets you borrow a NativeByteOrder<T> reference whose Drop method puts back the original value. And maybe that's what BurntSushi's crate does. Or maybe it avoids that because that reference cannot be made zero cost. In any case we should look into what capnproto-rust does for this. And maybe ask it's developer why he did what he did. Jeff
signature.asc
Description: This is a digitally signed message part
_______________________________________________ GNUnet-developers mailing list [email protected] https://lists.gnu.org/mailman/listinfo/gnunet-developers
