1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! `formatx` lets you format strings at runtime using the same syntax as
//! [`std::fmt`] (`{}`, `{:?}`, `{name}`, etc.), but with runtime template
//! strings instead of compile-time literals with **zero** dependencies.
//!
//! # Using [`formatx!`]
//!
//! Works just like [`format!`], but accepts runtime template strings.
//!
//! ```
//! use formatx::formatx;
//!
//! let template = "{} scored {score:.1}% in {}";
//! let result = formatx!(template, "Alice", "maths", score = 95.678).unwrap();
//! assert_eq!(result, "Alice scored 95.7% in maths");
//! ```
//!
//! **Note:** Extra arguments that aren't referenced by any placeholder are
//! silently ignored in both [`formatx!`] and [`formatxl!`].
//!
//! # Template Reuse
//!
//! Parse once, render many times with [`Template`].
//!
//! ```
//! use formatx::Template;
//!
//! let template = Template::new("{name} has {n} items").unwrap();
//!
//! let r1 = template.render()
//! .named("name", &"Alice")
//! .named("n", &3)
//! .finish()
//! .unwrap();
//!
//! let r2 = template.render()
//! .named("name", &"Bob")
//! .named("n", &7)
//! .finish()
//! .unwrap();
//!
//! assert_eq!(r1, "Alice has 3 items");
//! assert_eq!(r2, "Bob has 7 items");
//! ```
pub use FormatType;
pub use Error;
pub use Renderer;
pub use Template;
pub use FormatValue;