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
//! The `Component` trait — the core abstraction of Ferrum Email.
//!
//! Every email template and reusable email element implements this trait.
use crateNode;
/// The core trait for all Ferrum Email components.
///
/// Components are composable building blocks for email templates. Each component
/// defines how it renders to a `Node` tree, which the renderer then converts
/// to email-safe HTML.
///
/// # Examples
///
/// ```
/// use ferrum_email_core::{Component, Node, node::Element, node::Tag};
///
/// struct HelloEmail {
/// name: String,
/// }
///
/// impl Component for HelloEmail {
/// fn render(&self) -> Node {
/// Node::text(format!("Hello, {}!", self.name))
/// }
///
/// fn subject(&self) -> Option<&str> {
/// Some("Hello!")
/// }
/// }
/// ```