trait_cast/
lib.rs

1#![doc = include_str!("../README.md")]
2#![no_std]
3#![expect(
4  unsafe_code,
5  reason = "The function transmutations require unsafe code."
6)]
7#![allow(incomplete_features)]
8#![feature(
9  const_type_name,    // Needed for `Debug` implementation
10  min_specialization, // Needed to unify the interface between downcast and traitcast (could be avoided with !Trait bounds or trait generics)
11  ptr_metadata,       // Needed to deal with pointer address(and provenance) separately from metadata
12  doc_cfg             // For nicer Docs
13)]
14#![cfg_attr(feature = "downcast_unchecked", feature(downcast_unchecked))]
15
16#[cfg(feature = "alloc")]
17extern crate alloc;
18
19mod trait_cast;
20pub use trait_cast::*;
21
22mod decl_macro;
23
24pub use trait_cast_macros::TraitcastableAny;
25
26#[cfg(test)]
27mod test;