pub struct RawNetworkConfig { /* private fields */ }Expand description
An unvalidated network configuration. Add nodes with add_node,
then call build to validate and produce a NetworkConfig.
§JSON format
RawNetworkConfig implements Serialize/Deserialize and can be loaded from JSON:
{
"hosts": [
{ "hostname": "node1", "port": 10000, "ibdev": "mlx5_0", "rankid": 0 },
{ "hostname": "node2", "port": 10000, "ibdev": "mlx5_0", "rankid": 1 }
]
}The optional comment field is omitted from serialization when empty.
Implementations§
Source§impl RawNetworkConfig
impl RawNetworkConfig
Sourcepub fn add_node(self, node: NodeConfig) -> Self
pub fn add_node(self, node: NodeConfig) -> Self
Appends a node to the configuration.
Sourcepub fn truncate(self, num_nodes: usize) -> Self
pub fn truncate(self, num_nodes: usize) -> Self
Truncates the node list to at most num_nodes entries.
Sourcepub fn build(self) -> Result<NetworkConfig, NetworkConfigError>
pub fn build(self) -> Result<NetworkConfig, NetworkConfigError>
Validates and builds the NetworkConfig.
Ranks must be unique, sequential, and start at 0. Nodes are sorted by rank.
Trait Implementations§
Source§impl Clone for RawNetworkConfig
impl Clone for RawNetworkConfig
Source§fn clone(&self) -> RawNetworkConfig
fn clone(&self) -> RawNetworkConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RawNetworkConfig
impl Debug for RawNetworkConfig
Source§impl Default for RawNetworkConfig
impl Default for RawNetworkConfig
Source§fn default() -> RawNetworkConfig
fn default() -> RawNetworkConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for RawNetworkConfig
impl<'de> Deserialize<'de> for RawNetworkConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RawNetworkConfig
impl RefUnwindSafe for RawNetworkConfig
impl Send for RawNetworkConfig
impl Sync for RawNetworkConfig
impl Unpin for RawNetworkConfig
impl UnsafeUnpin for RawNetworkConfig
impl UnwindSafe for RawNetworkConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more