[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [GNUnet-developers] [GSoC] Question on "Rust implementation of GNUne
Re: [GNUnet-developers] [GSoC] Question on "Rust implementation of GNUnet utils" project
Wed, 27 Apr 2016 16:44:51 +0200
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.
Second, we Florian pointed out that single element tuple structs act
like newtypes in Haskell :
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.
Description: This is a digitally signed message part