former 2.45.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
//! This example tests Former with a minimal lifetime struct.

#![allow(missing_docs, dead_code)]

#[ cfg( feature = "enabled" ) ]
use former::Former;

#[ derive( Debug, Former ) ]
pub struct Minimal<'a> {
  data: &'a str,
}

fn main() {
  let s = "hello";
  let instance = Minimal::former().data(s).form();
  println!("{instance:?}");
}