The following code show how to pack/unpack parameters.
fn test_idl_encode_decode(){
let args1 = candid::Encode!().unwrap();
assert_eq!([68, 73, 68, 76, 0, 0].to_vec(), args1);
let args2 = candid::Encode!(&"hello", &"world").unwrap();
assert_eq!([68, 73, 68, 76, 0, 2, 113, 113, 5, 104, 101, 108, 108, 111, 5, 119, 111, 114, 108, 100].to_vec(), args2);
let decoded_agrs2 = candid::Decode!(&args2, String, String).unwrap();
assert_eq!("hello", decoded_agrs2.0);
assert_eq!("world", decoded_agrs2.1);
let args3 = candid::Encode!(&"hello,world", &2u32).unwrap();
assert_eq!([68, 73, 68, 76, 0, 2, 113, 121, 11, 104, 101, 108, 108, 111, 44, 119, 111, 114, 108, 100, 2, 0, 0, 0].to_vec(), args3);
let decoded_agrs3 = candid::Decode!(&args3, String, u32).unwrap();
assert_eq!("hello,world", decoded_agrs3.0);
assert_eq!(2, decoded_agrs3.1);
}