jedisct1 / rust-libhydrogen

Libhydrogen bindings for Rust.
16 stars 3 forks source link

impl: hydro_kx #6

Closed chiefbiiko closed 4 years ago

chiefbiiko commented 4 years ago
chiefbiiko commented 4 years ago

@jedisct1 would be awesome if you could have a look if you want to merge, would either need to bump libhydrogen-sys to sth like 0.9.0 (forgot this in scope of jedisct1/rust-libhydrogen-sys#2) or just undo the libhydrogen-sys > 0.8.1 requirement in this pr's cargo toml

jedisct1 commented 4 years ago

Hi!

And sorry for the delay; I completely forgot about your pull request.

Looking good!

I'm going to push an update version to crates.io

Thanks again for contributing this!

jedisct1 commented 4 years ago
impl State {
    pub fn new() -> State {
        unsafe { MaybeUninit::<State>::uninit().assume_init() }
    }
}

Maybe the public interface shouldn't allow returning an uninitialized state.

It may be safer to let functions such as kk_1 return a state instead.

jedisct1 commented 4 years ago

Same for returned packets. For example n_1() could return an initialized NPacket1 instead of accepting an empty one.

jedisct1 commented 4 years ago

So, maybe all the &mut parameters currently required could be replaced with things these functions return.

chiefbiiko commented 4 years ago

thanks for your feedback! will prepare a follow-up pr