#any

no-std downcast

Trait for downcasting trait objects back to their original types

19 releases (10 breaking)

0.10.0 Feb 13, 2019
0.9.2 Feb 15, 2018
0.9.1 Sep 16, 2017
0.9.0 Apr 25, 2017
0.2.1 Oct 26, 2015

#47 in Rust patterns

Download history 328/week @ 2018-12-20 358/week @ 2018-12-27 368/week @ 2019-01-03 466/week @ 2019-01-10 476/week @ 2019-01-17 364/week @ 2019-01-24 378/week @ 2019-01-31 319/week @ 2019-02-07 329/week @ 2019-02-14 281/week @ 2019-02-21 321/week @ 2019-02-28 135/week @ 2019-03-07 150/week @ 2019-03-14 290/week @ 2019-03-21 149/week @ 2019-03-28

1,304 downloads per month
Used in 10 crates (5 directly)

MIT license

14KB
248 lines

downcast

A trait (& utilities) for downcasting trait objects back to their original types.

link to API documentation

example usage

Add to your Cargo.toml:

[dependencies]
downcast = "0.8"

Add to your crate root:

#[macro_use]
extern crate downcast;
  • simple showcases the most simple usage of this library.
  • with_params showcases how to deal with traits who have type parameters.

build features

  • std (default) enables all functionality requiring the standard library (Downcast::downcast()).
  • nightly enables all functionality requiring rust nightly (Any::type_name()).

No runtime deps