#type-id #structures #no-alloc

no-std optional_typeid

Compressed structure Option<TypeId>

2 unstable releases

0.2.0 Oct 1, 2025
0.1.0 Sep 30, 2025

#614 in Compression

29 downloads per month

MIT license

8KB
191 lines

Compressed structure Option<TypeId>


lib.rs:

OptionalTypeId is an alternative for Option<TypeId>, uses memory also TypeId.

This crate is #[no_std].

Example

use std::any::TypeId;
use optional_typeid::OptionalTypeId;

let id = OptionalTypeId::of::<()>();

assert_eq!(size_of::<TypeId>(), size_of_val(&id));
assert_eq!(Some(TypeId::of::<()>()), id.into_option());

No runtime deps