fundamental_data_type 0.1.6

Fundamental data types and type constructors, like Single, Pair, Many.
Documentation

Module :: fundamental_data_type

experimental rust-status docs.rs discord

Fundamental data types and type constructors, like Single, Pair, Homopair, Many.

In Rust, you often need to wrap a given type into a new one. The role of the orphan rules in particular is basically to prevent you from implementing external traits for external types. To overcome the restriction developer usually wrap the external type into a tuple introducing a new type. Type constructor does exactly that and auto-implement traits From, Into, Deref and few more for the constructed type.

Besides type constructor for single element there are type constructors for pair, homopair and many:

  • Single to wrap single element.
  • Pair to wrap pair of distinct elements.
  • HomoPair to wrap pair of elements with the same type.
  • Many to wrap Vec of elements.

To add to your project

cargo add type_constructor

Try out from the repository

git clone https://github.com/Wandalen/wTools
cd wTools
cd sample/rust/type_constructor_trivial_sample
cargo run