#any

no-std downcast

Trait for downcasting trait objects back to their original types

18 releases (9 breaking)

0.9.2 Feb 15, 2018
0.9.1 Sep 16, 2017
0.9.0 Apr 25, 2017
0.6.0 Mar 14, 2016
0.2.1 Oct 26, 2015

#38 in No standard library

Download history 277/week @ 2018-08-16 305/week @ 2018-08-23 311/week @ 2018-08-30 254/week @ 2018-09-06 286/week @ 2018-09-13 337/week @ 2018-09-20 285/week @ 2018-09-27 312/week @ 2018-10-04 158/week @ 2018-10-11 310/week @ 2018-10-18 162/week @ 2018-10-25 371/week @ 2018-11-01 358/week @ 2018-11-08

482 downloads per month
Used in 14 crates (7 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()).

contribution guidelines

Make sure to cargo install rustfmt and cargo fmt the codebase before creating any commits!

No runtime deps