samedi 27 août 2016

C Abstract Data Type in Rust

I have this code in my header file:

typedef struct _game* Game;

Right now to FFI from Rust I'm doing:

extern "C" {
    pub type Game = usize;
}

Is there a safer way to do this than to treat it like a pointer-sized numeric type? Would this work:

pub struct Game(usize);

Aucun commentaire:

Enregistrer un commentaire