pub unsafe extern "C" fn xD(keys: K, values: K) -> KExpand description
Constructor of q dictionary object.
ยงExample
#[macro_use]
extern crate kdbplus;
use kdbplus::qtype;
use kdbplus::api::*;
use kdbplus::api::native::*;
#[no_mangle]
pub extern "C" fn create_dictionary() -> K{
let keys=unsafe{ktn(qtype::INT_LIST as I, 2)};
keys.as_mut_slice::<I>()[0..2].copy_from_slice(&[0, 1]);
let values=unsafe{knk(2)};
let date_list=unsafe{ktn(qtype::DATE_LIST as I, 3)};
// 2000.01.01 2000.01.02 2000.01.03
date_list.as_mut_slice::<I>()[0..3].copy_from_slice(&[0, 1, 2]);
let string=unsafe{kp(str_to_S!("I'm afraid I would crash the application..."))};
values.as_mut_slice::<K>()[0..2].copy_from_slice(&[date_list, string]);
unsafe{xD(keys, values)}
}q)create_dictionary: `libc_api_examples 2: (`create_dictionary; 1);
q)create_dictionary[]
0| 2000.01.01 2000.01.02 2000.01.03
1| "I'm afraid I would crash the application..."