Releases: lloydmeta/frunk
Releases · lloydmeta/frunk
0.4.3 release
Please see the changelog for details
- #236 , thanks to @mammothbane is the VIP here.
Frunk laws 0.5.0
Bumped due to new quickcheck (1.x-based now!)
0.4.2 release
See changelog for details.
Much thanks to the efforts of @CobaltCause.
0.4.1 release
0.4.0 release
Lots of good stuff thanks to team work from a number of contributors (incl @mbrobbel, @ImmemorConsultrixContrarie , @ExpHP)
From the Changelog
- [Breaking change] Rename
Hlist!
type macro toHList!
(#132) - [Breaking change] Remove deprecated
HList.length()
(#125) - [Breaking change]
HFoldRightable
rework: nowHFoldRightable::foldr
does not differ fromHFoldLeftable::foldl
in calling, likestd::iter::DoubleEndedIterator::rfold
does not differ fromstd::iter::Iterator::fold
. Note: thoughfoldr
behavior wasn't changed, all oldfoldr
calls would either stop compiling or produce wrong results (#171) - [Breaking change] Bump quote, syn and proc-macro2 to 1 (#183)
- Fix unicode identifiers support #186
0.3.2 release
- Allow folding hlist with a single Poly (#170)
0.3.1 release
v0.3.0 release
v0.2.4 release
Added
- Added
ToMut
trait, which allows borrowing mutably from a Coproduct or HList. - Added support for
#[derive(LabelledGeneric)]
on tuple structs - Added
Path
model andPathTraverser
trait, which allows for composable lens-like-usage
Changed
- Make macros call themselves recursively with
$crate::
v0.2.2 release (Transmogrify!)
Adds support for transmogrifying data of different types
#[macro_use]
extern crate frunk_core;
use frunk::labelled::Transmogrifier;
#[derive(LabelledGeneric)]
struct InternalPhoneNumber {
emergency: Option<usize>,
main: usize,
secondary: Option<usize>,
}
#[derive(LabelledGeneric)]
struct InternalAddress<'a> {
is_whitelisted: bool,
name: &'a str,
phone: InternalPhoneNumber,
}
#[derive(LabelledGeneric)]
struct InternalUser<'a> {
name: &'a str,
age: usize,
address: InternalAddress<'a>,
is_banned: bool,
}
#[derive(LabelledGeneric, PartialEq, Debug)]
struct ExternalPhoneNumber {
main: usize,
}
#[derive(LabelledGeneric, PartialEq, Debug)]
struct ExternalAddress<'a> {
name: &'a str,
phone: ExternalPhoneNumber,
}
#[derive(LabelledGeneric, PartialEq, Debug)]
struct ExternalUser<'a> {
age: usize,
address: ExternalAddress<'a>,
name: &'a str,
}
let internal_user = InternalUser {
name: "John",
age: 10,
address: InternalAddress {
is_whitelisted: true,
name: "somewhere out there",
phone: InternalPhoneNumber {
main: 1234,
secondary: None,
emergency: Some(5678),
},
},
is_banned: true,
};
/// Boilerplate-free conversion of a top-level InternalUser into an
/// ExternalUser, taking care of subfield conversions as well.
let external_user: ExternalUser = internal_user.transmogrify();
let expected_external_user = ExternalUser {
name: "John",
age: 10,
address: ExternalAddress {
name: "somewhere out there",
phone: ExternalPhoneNumber {
main: 1234,
},
}
};
assert_eq!(external_user, expected_external_user);