#chaining #mutable #modifiers #api #user #modification #fluid

modifier

Fluid chaining APIs for both mutable ownership types

10 releases

Uses old Rust 2015

0.1.0 Apr 3, 2015
0.0.9 Jan 29, 2015
0.0.5 Dec 27, 2014
0.0.3 Nov 28, 2014

#4 in #modifiers

Download history 8724/week @ 2024-02-27 10135/week @ 2024-03-05 8066/week @ 2024-03-12 9813/week @ 2024-03-19 6677/week @ 2024-03-26 10053/week @ 2024-04-02 8545/week @ 2024-04-09 9161/week @ 2024-04-16 11183/week @ 2024-04-23 7719/week @ 2024-04-30 9837/week @ 2024-05-07 11484/week @ 2024-05-14 8512/week @ 2024-05-21 9042/week @ 2024-05-28 9483/week @ 2024-06-04 8933/week @ 2024-06-11

38,212 downloads per month
Used in 193 crates (12 directly)

MIT license

5KB
112 lines

Rust-Modifier

Chaining APIs for both self -> Self and &mut self methods.

Example

let mut thing = Thing { x: 6 };
thing.set_mut(ModifyX(8));
assert_eq!(thing.x, 8);

let thing = thing.set(ModifyX(9));
assert_eq!(thing.x, 9);

Overview

Rust-modifier allows you to define modifiers just once, then use them through both set and set_mut, allowing downstream users the ability to use whichever API is most convenient.

Additionally, rust-modifier allows users to define their own modifiers, arbitrarily extending the utility of existing types.

LICENSE

MIT


lib.rs:

Overloadable modification through both owned and mutable references to a type with minimal code duplication.

No runtime deps