Function kdb_c_api::new_dictionary [−][src]
pub fn new_dictionary(keys: K, values: K) -> K
Expand description
Constructor of q dictionary object.
Example
use kdb_c_api::*; #[no_mangle] pub extern "C" fn create_dictionary() -> K{ let keys=new_simple_list(qtype::INT, 2); keys.as_mut_slice::<I>()[0..2].copy_from_slice(&[0, 1]); let values=new_simple_list(qtype::COMPOUND, 2); let date_list=new_simple_list(qtype::DATE, 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: `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..."