try_cast

Macro try_cast 

Source
macro_rules! try_cast {
    ($ex:expr; $t:ty) => { ... };
}
Expand description

Tries to cast a KBox, &KBox or &Any to another KDB type.

returns a result containing the KDB type, or a ConversionError.

ยงExample

let a: KBox<Any> = symbol("Hello").into();
assert_eq!(symbol("Hello"), try_cast!(a; Atom<Symbol>).unwrap().value());