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
use ;
/// Builder for creating `Nodes` programmatically.
///
/// This builder allows you to construct node lists when building DBC files
/// programmatically. It validates that node names are unique and within limits.
///
/// # Examples
///
/// ```rust,no_run
/// use dbc_rs::NodesBuilder;
///
/// let nodes = NodesBuilder::new()
/// .add_node("ECM")
/// .add_node("TCM")
/// .add_node("BCM")
/// .build()?;
///
/// assert_eq!(nodes.len(), 3);
/// assert!(nodes.contains("ECM"));
/// # Ok::<(), dbc_rs::Error>(())
/// ```
///
/// # Adding Comments
///
/// You can add comments to nodes using `add_node_with_comment`:
///
/// ```rust,no_run
/// use dbc_rs::NodesBuilder;
///
/// let nodes = NodesBuilder::new()
/// .add_node_with_comment("ECM", "Engine Control Module")
/// .add_node("TCM")
/// .build()?;
///
/// assert_eq!(nodes.node_comment("ECM"), Some("Engine Control Module"));
/// assert_eq!(nodes.node_comment("TCM"), None);
/// # Ok::<(), dbc_rs::Error>(())
/// ```
///
/// # Validation
///
/// The builder validates:
/// - Maximum of 256 nodes (DoS protection)
/// - All node names must be unique (case-sensitive)
/// - Maximum 32 characters per node name
/// - Maximum number of nodes (implementation limit for DoS protection)
///
/// # Feature Requirements
///
/// This builder requires the `std` feature to be enabled.