Como indexar matrizes C no Rust?
Eu tenho uma função C retornando um ponteiro:
type MYSQL_RES_REF = *mut c_void;
type MYSQL_ROW = *const *const c_char;
#[no_mangle]
extern "C" {
fn mysql_fetch_row(res: MYSQL_RES_REF) -> MYSQL_ROW;
}
let pointer = mysql_fetch_row(self.res);
let row_p = match pointer {
p if p == (0 as *const *const c_char) => panic!(),
p => p,
};
let field: &[u8] = unsafe { ffi::c_str_to_bytes(row_p[i]) };
mas tentar indexá-lo (a última linha) resulta em um erro:
error: cannot index a value of type `*const *const i8`
Eu me pergunto sestd::c_vec
era o que eu queria, masaparentemente isso foi removido.