former 2.43.0

A flexible implementation of the Builder pattern supporting nested builders and collection-specific subformers. Simplify the construction of complex objects.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#![allow(clippy::used_underscore_binding, clippy::all, warnings, missing_docs)]
//! Simple test to isolate the E0106 lifetime issue

use former::Former;

/// Simple test struct with lifetime parameter.
#[ derive( Debug, PartialEq, Former ) ]
pub struct SimpleTest<'a> {
    /// Test data field.
    data: &'a str,
}

#[ test ]
fn simple_test() {
    let input = "test";
    let instance = SimpleTest::former().data(input).form();
    assert_eq!(instance.data, "test");
}