#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Node {
pub id: i32,
pub host: String,
pub port: i32,
pub rack: Option<String>,
}
impl Node {
#[must_use]
pub fn new(id: i32, host: impl Into<String>, port: i32) -> Self {
Self {
id,
host: host.into(),
port,
rack: None,
}
}
#[must_use]
pub fn with_rack(mut self, rack: impl Into<String>) -> Self {
self.rack = Some(rack.into());
self
}
#[must_use]
pub const fn is_empty(&self) -> bool {
self.id < 0
}
}