fuzzycopy 1.0.2
Copying data from one struct type to another for lazy people
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
fuzzyCP
Who knows the problem, you have a struct Foo of form
struct Foo {
int a = 10;
int b = 20;
}
and need to copy it to a struct Bar of form
struct Bar {
long a;
byte b;
}
You could copy the field by hands, or use fuzzyCP. fuzzyCP will copy all members from Foo to Bar where Foo and Bar members have the same name.
Use it like so:
Foo foo;
assert(foo.a == 10);
assert(foo.b == 20);
Bar bar;
fuzzyCP(foo, bar);
assert(bar.a == 10);
assert(bar.b == 20);
By default, fuzzyCP will do a best effort copy of all the members of Foo to Bar. That means, if Foo has a member that Bar does not have nothing will happen. If a member in Foo can be converted with std.conv.to that function will be used.
- Registered by Robert Schadek
- 1.0.2 released a year ago
- burner/FuzzyCopy
- LGPL3
- Copyright © 2018, burner
- Authors:
- Dependencies:
- none
- Versions:
-
1.0.2 2023-Dec-15 1.0.1 2021-Oct-29 1.0.0 2019-Jul-17 0.3.0 2019-Jun-20 0.2.1 2018-Sep-11 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
84 downloads this month
-
9092 downloads total
-
- Score:
- 2.0
- Short URL:
- fuzzycopy.dub.pm