use super::Nodes;
use crate::BU_;
use std::fmt::{Display, Formatter, Result};
impl Display for Nodes {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
if self.nodes.is_empty() {
return Ok(());
}
for (i, node) in self.iter().enumerate() {
if i > 0 {
write!(f, " ")?;
}
write!(f, "{}", node)?;
}
Ok(())
}
}
impl Nodes {
#[must_use = "return value should be used"]
pub fn to_dbc_string(&self) -> std::string::String {
let mut result = format!("{}:", BU_);
let nodes_str = format!("{}", self);
if !nodes_str.is_empty() {
result.push(' ');
result.push_str(&nodes_str);
}
result
}
}