dbc_rs/nodes/builder/
mod.rs

1use std::{string::String, vec::Vec};
2
3/// Builder for creating `Nodes` programmatically.
4///
5/// This builder allows you to construct node lists when building DBC files
6/// programmatically. It validates that node names are unique and within limits.
7///
8/// # Examples
9///
10/// ```rust,no_run
11/// use dbc_rs::NodesBuilder;
12///
13/// let nodes = NodesBuilder::new()
14///     .add_node("ECM")
15///     .add_node("TCM")
16///     .add_node("BCM")
17///     .build()?;
18///
19/// assert_eq!(nodes.len(), 3);
20/// assert!(nodes.contains("ECM"));
21/// # Ok::<(), dbc_rs::Error>(())
22/// ```
23///
24/// # Validation
25///
26/// The builder validates:
27/// - Maximum of 256 nodes (DoS protection)
28/// - All node names must be unique (case-sensitive)
29/// - Maximum 32 characters per node name
30/// - Maximum number of nodes (implementation limit for DoS protection)
31///
32/// # Feature Requirements
33///
34/// This builder requires the `std` feature to be enabled.
35#[derive(Debug)]
36pub struct NodesBuilder {
37    pub(crate) nodes: Vec<String>,
38}
39
40mod build;
41mod impls;