Feature | dyntable | thin_trait_object | cglue | abi_stable | vtable |
---|---|---|---|---|---|
Version | 0.1.0 | 1.1.2 | 0.2.12 | 0.11.1 | 0.1.9 |
License | Apache-2.0 | MIT/Apache-2.0 | MIT | MIT/Apache-2.0 | GPLv3 |
no-std support | ✔️ | ✔️1 | ✔️ | ❌ | ✔️ |
Pointer Type | Fat | Thin | Fat | Fat | Fat |
Supports References | ✔️ | ❌ | ✔️ | ✔️ | ✔️ |
Non-Box Trait Containers | ❌ | ❌ | ✔️ | ✔️ | ✔️ |
Custom Allocators | ✔️ | ❌ | ❌ | ❌ | ❌ |
Uses Thunks2 | By-Value Fns | Never | Always | Unknown | Always |
Trait Bounds / Supertraits | ✔️3 | ✔️4 | ❌ | ✔️5 | ❌ |
Trait Groups6 | ❌ | ❌ | ✔️ | ❌ | ❌ |
Trait Generics | ✔️ | ❌ | ✔️ | ✔️ | ❌ |
Default Generics | ✔️ | ❌ | ❌ | ✔️ | ❌ |
Trait Lifetime Generics | ✔️ | ❌ | ❌ | ✔️ | ❌ |
Fn Generics | ❌ | ❌ | Panics | ❌ | ❌ |
Fn Lifetime Generics | ✔️ | ❌ | ✔️ | ✔️ | ❌ |
Upcasting | ✔️ | ❌ | ❌ | ❌ | ❌ |
Downcasting | ❌ | ❌ | ❌ | ✔️ | ✔️ |
Constants | ❌ | ❌ | ❌ | ❌ | ✔️ |
Associated Types | ❌ | ❌ | ✔️ | ✔️ | ❌ |
Field Offsets | ❌ | ❌ | ❌ | ❌ | ✔️ |
Duplicate Trait Name | ✔️ | ✔️ | ✔️ | ✔️ | ❌ |
Layout Validation | ❌ | ❌ | ✔️ | ✔️ | ❌ |
Single Macro7 | ✔️ | ✔️ | ❌ | ✔️ | ❌ |
No Reborrowing8 | ❌ | No Ref Types | ❌ | ❌ | ❌ |
Footnotes
-
Thin-trait-object has no runtime component. ↩
-
Intermediary functions used for type conversion that cannot be inlined. ↩
-
Dyntable traits can only have bounds on other dyntable traits (without associated types) and Send or Sync. ↩
-
Requires manually writing impls and thunks for bound methods. ↩
-
Abi-Stable traits can only have bounds on a specific selection of traits (see abi_stable docs for details), ↩
-
Trait groups are non trait bound / supertrait based groupings of traits. See the cglue docs for details. ↩
-
Only one macro is required, on the trait definition. ↩
-
Reborrowing is when a reference is represented by an owned type, and needs to have a function called to borrow it. ↩