#chaining #transformation #trans #no-std #small

no-std chain-trans

Utility for chaining function applications onto structs in continuation-style

1 stable release

1.0.0 Aug 7, 2022

#245 in No standard library

Used in 2 crates

MIT license



Simple rust utility library for applying functions to structures in chains, and chaining functions together (also, trans rights! 🏳️‍⚧️)).

This lets you write code in fluent style with essentially arbitrary functions - with benefits to readability (in particular, avoiding messy intermediary variables when you use free functions), ease of logging, and structuring code in terms of data transformations.

This crate is inspired by the pleasantness of chaining calls within the framework of rust iterators, maps, and filters.


use chain_trans::prelude::*;

pub struct Point(f32, f32);

let parameterised_point = 3.0f32
    .trans(|a| Point(a, a * 2))
    .trans_inspect(|Point(x, y)| eprintln!("Current point is at {x}, {y}"));


Library for conveniently combining and applying to structures.

See [Trans] for more info.

No runtime deps