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_id,      // Needed to enable `TraitcastTarget::create` to be const
10  const_type_name,    // Needed for `Debug` implementation
11  min_specialization, // Needed to unify the interface between downcast and traitcast (could be avoided with !Trait bounds or trait generics)
12  ptr_metadata,       // Needed to deal with pointer address(and provenance) separately from metadata
13  doc_cfg             // For nicer Docs
14)]
15#![cfg_attr(feature = "downcast_unchecked", feature(downcast_unchecked))]
16
17#[cfg(feature = "alloc")]
18extern crate alloc;
19
20mod trait_cast;
21pub use trait_cast::*;
22
23mod decl_macro;
24
25pub use trait_cast_macros::make_trait_castable;
26
27#[cfg(test)]
28mod test;