kdb 0.3.0

Idiomatic, High performance API for using KDB+ and Q from Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use kdb::{cast, try_cast, Any, Atom, KBox};

fn main() {
    let int = KBox::new_atom(42);

    // convert to an "any" value:
    let any: KBox<Any> = int.into();

    // convert back to an i32 atom.
    let int = cast!(any; Atom<i32>);
    println!("{:?}", int);

    let any: KBox<Any> = int.into();
    // try to convert to a u8 atom. This will fail!
    if let Err(e) = try_cast!(any; Atom<u8>) {
        println!("Error: {}", e);
    }
}