Crates.io | modifier |
lib.rs | modifier |
version | 0.1.0 |
source | src |
created_at | 2014-11-11 06:33:21.844544 |
updated_at | 2015-12-16 00:01:49.263868 |
description | Fluid chaining APIs for both mutable ownership types. |
homepage | |
repository | https://github.com/reem/rust-modifier |
max_upload_size | |
id | 30 |
size | 4,496 |
Chaining APIs for both
self -> Self
and&mut self
methods.
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);
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.
MIT