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
use Value;
use Serialize;
/// A trait for converting types into minijinja template values
///
/// This trait provides a uniform way to convert Rust types into values that can be
/// used in minijinja templates. It's automatically implemented for all types that
/// implement [Serialize].
///
/// # Examples
///
/// ```rust
/// use serde::Serialize;
///
/// #[derive(Serialize)]
/// struct User {
/// name: String,
/// age: u32,
/// }
///
/// let user = User {
/// name: String::from("Alice"),
/// age: 30,
/// };
///
/// // Convert to minijinja Value for template rendering
/// let template_value = user.to_value();
/// ```
/// Blanket implementation for all types that implement [Serialize]
///
/// This allows any type that can be serialized to be automatically used
/// as a template context.