Crate variadic_from
source ·Expand description
Variadic from.
Module :: variadic_from
Variadic from
Basic use-case.
use variadic_from::exposed::*;
fn main()
{
#[ derive( Debug, PartialEq, Default, VariadicFrom ) ]
struct StructNamedFields
{
a : i32,
b : i32,
}
let got : StructNamedFields = From::from( ( 13, 14 ) );
let exp = StructNamedFields{ a : 13, b : 14 };
assert_eq!( got, exp );
}
To add to your project
cargo add variadic_from
Try out from the repository
git clone https://github.com/Wandalen/wTools
cd wTools
cargo run --example variadic_from_trivial
Re-exports
Modules
- Dependencies.
- Exposed namespace of the module.
- Orphan namespace of the module.
- Prelude to use essentials:
use my_module::prelude::*
. - Protected namespace of the module.
- Types, which are extension of std.
Macros
- Variadic constructor.
Traits
- Constructor without arguments. Alias of Default.
- Constructor with single argument.
- Constructor with two arguments.
- Constructor with three arguments.
- value-to-value conversion that consumes the input value. Change left and rught, but keep semantic of `From_1``.
Derive Macros
- Derive macro to implement default constructors
From_0
,From_1
,From_2
,From_3
.