Skip to content

Latest commit

 

History

History
41 lines (39 loc) · 5.71 KB

COMPARISON.md

File metadata and controls

41 lines (39 loc) · 5.71 KB
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

  1. Thin-trait-object has no runtime component.

  2. Intermediary functions used for type conversion that cannot be inlined.

  3. Dyntable traits can only have bounds on other dyntable traits (without associated types) and Send or Sync.

  4. Requires manually writing impls and thunks for bound methods.

  5. Abi-Stable traits can only have bounds on a specific selection of traits (see abi_stable docs for details),

  6. Trait groups are non trait bound / supertrait based groupings of traits. See the cglue docs for details.

  7. Only one macro is required, on the trait definition.

  8. Reborrowing is when a reference is represented by an owned type, and needs to have a function called to borrow it.