match-downcast

Crates.iomatch-downcast
lib.rsmatch-downcast
version0.1.2
sourcesrc
created_at2017-09-10 22:32:44.061639
updated_at2017-09-11 10:20:20.998162
descriptionA set of downcasting matching Rust macros.
homepagehttps://github.com/fst3a/match-downcast
repositoryhttps://github.com/fst3a/match-downcast
max_upload_size
id31333
size8,996
Constantine (fst3a)

documentation

https://docs.rs/match-downcast

README

Set of downcasting matching macros akin to what Scala's match or Haskell's case can do. Useful in actor models etc.

let a = Box::new(5_i32) as Box<Any>;
let b = match_downcast!(a, {
    x: i32 => x
    y: f32 => x as i32,
    z: () => -1,
    _ => panic!()
});

assert_eq!(b, 5);
Commit count: 0

cargo fmt