expanding for different types
How would I expand the ffi.rs to allow for more different types, such as 'u8'
Sincerely, Dallyshalla
pub enum QrsVariantType { Invalid = 0, Int64, String } pub fn qmlrs_variant_create() -> *mut QVariant; pub fn qmlrs_variant_destroy(v: *mut QVariant); pub fn qmlrs_variant_set_int64(var: *mut QVariant, x: i64); pub fn qmlrs_variant_set_invalid(var: *mut QVariant); pub fn qmlrs_variant_set_string(var: *mut QVariant, len: c_uint, data: *const c_char); pub fn qmlrs_variant_get_type(var: *const QVariant) -> QrsVariantType; pub fn qmlrs_variant_get_int64(var: *const QVariant, x: *mut i64); pub fn qmlrs_variant_get_string_length(var: *const QVariant, out: *mut c_uint); pub fn qmlrs_variant_get_string_data(var: *const QVariant, out: *mut c_char);
I was curious, too and added bool (instead of u8). I modified the factorial example such that it randomly gets true, false as input (and returns it without modification) Have a look at https://github.com/Liamsi/qmlrs/commit/c9356c814b8dd225783e225dd887f21d5617cf8a to get an idea on howto expand to other types. The diff should be self explanatory (run by cargo run --example oracle)