This is how the C API looks
void mosquitto_connect_callback_set(struct mosquitto *mosq, void (*on_connect)(struct mosquitto *, void *, int));
rust-bindgen
has generated this for me
pub fn mosquitto_connect_callback_set(
mosq: *mut Struct_mosquitto,
on_connect: ::std::option::Option<
extern "C" fn(
arg1: *mut Struct_mosquitto,
arg2: *mut ::libc::c_void,
arg3: ::libc::c_int,
) -> (),
>,
)
How do I create a Rust callback function to pass to the on_connect
parameter in the above Rust binding?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…