Skip to content

Releases: lloydmeta/frunk

0.4.3 release

31 Aug 13:24
f413e1d
Compare
Choose a tag to compare

Please see the changelog for details

Frunk laws 0.5.0

11 Feb 09:02
c93709d
Compare
Choose a tag to compare

Bumped due to new quickcheck (1.x-based now!)

0.4.2 release

17 Jun 13:55
df2d6ea
Compare
Choose a tag to compare

See changelog for details.

Much thanks to the efforts of @CobaltCause.

0.4.1 release

03 Nov 06:55
ff5dafc
Compare
Choose a tag to compare

Lots of good stuff thanks to team work from a number of contributors (incl steffahn, kpp, agluszak, rosefromthedead, and BGR360)

From the Changelog

  • Documentation fix for Hcons::sculpt (#194)
  • Optimise Semigroup for HashSet and HashMap (#196)
  • Update to 2021 edition (#200)
  • Add extract to get value out of 1-type coproduct (#201)
  • Fix needless borrow (#202)
  • Add Coproduct::map (#204)

0.4.0 release

25 Jun 02:14
1bb2b7d
Compare
Choose a tag to compare

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 to HList! (#132)
  • [Breaking change] Remove deprecated HList.length() (#125)
  • [Breaking change] HFoldRightable rework: now HFoldRightable::foldr does not differ from HFoldLeftable::foldl in calling, like std::iter::DoubleEndedIterator::rfold does not differ from std::iter::Iterator::fold. Note: though foldr behavior wasn't changed, all old foldr 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

16 Apr 06:02
a1f4383
Compare
Choose a tag to compare
  • Allow folding hlist with a single Poly (#170)

0.3.1 release

21 Dec 02:28
c76e6d3
Compare
Choose a tag to compare
  • Refactoring derives (#157)
  • Add support for deriving LabelledGeneric on enums (#158)
  • Added HZippable (#160)
  • Add a type macro for paths (#161)

v0.3.0 release

23 Mar 05:25
7fa5f47
Compare
Choose a tag to compare
  • More transmogrifications supported out of the box (#152)
    • Box, Option, Vec and more.
  • More idiomatic Debug impl for Field Debug impls should use DebugStruct #153
  • [no-std] support #148
    • Note: this is a breaking change, see the PR for details

v0.2.4 release

09 Feb 16:22
Compare
Choose a tag to compare

Added

  • Added ToMut trait, which allows borrowing mutably from a Coproduct or HList.
  • Added support for #[derive(LabelledGeneric)] on tuple structs
  • Added Path model and PathTraverser trait, which allows for composable lens-like-usage

Changed

  • Make macros call themselves recursively with $crate::

v0.2.2 release (Transmogrify!)

21 Oct 05:12
ef3a0bf
Compare
Choose a tag to compare

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);