pub fn new_dictionary(keys: K, values: K) -> KExpand description
Constructor of q dictionary object.
ยงExample
use kdbplus::api::*;
use kdbplus::qtype;
#[no_mangle]
pub extern "C" fn create_dictionary() -> K{
let keys=new_list(qtype::INT_LIST, 2);
keys.as_mut_slice::<I>()[0..2].copy_from_slice(&[0, 1]);
let values=new_list(qtype::COMPOUND_LIST, 2);
let date_list=new_list(qtype::DATE_LIST, 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=new_string("I'm afraid I would crash the application...");
values.as_mut_slice::<K>()[0..2].copy_from_slice(&[date_list, string]);
new_dictionary(keys, values)
}q)create_dictionary: `libapi_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..."