chain-trans 1.0.0

Utility for chaining function applications onto structs in continuation-style
Documentation
  • Coverage
  • 100%
    8 out of 8 items documented3 out of 6 items with examples
  • Size
  • Source code size: 7.44 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 639.91 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • infomorphic-matti/chain-trans
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • infomorphic-matti

chain-trans

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.

Examples

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