pub struct Hostfile {
pub backend: String,
pub hosts: Vec<String>,
}Expand description
Parsed hosts.json.
Fields§
§backend: StringBackend name; defaults to “tcp” when absent.
hosts: Vec<String>ip:port per rank, in rank order.
Implementations§
Source§impl Hostfile
impl Hostfile
pub fn from_json_str(s: &str) -> Result<Self>
Sourcepub fn loopback(ports: &[u16], backend: TransportBackend) -> Self
pub fn loopback(ports: &[u16], backend: TransportBackend) -> Self
Build a loopback hostfile: rank r listens on 127.0.0.1:ports[r].
This is the local-run analogue of hand-writing a hosts.json — used
by crate::launch::LocalCluster.
Sourcepub fn write_temp(&self, tag: &str) -> Result<PathBuf>
pub fn write_temp(&self, tag: &str) -> Result<PathBuf>
Write this hostfile to a uniquely-named file in the temp dir and
return its path. tag distinguishes concurrent runs.
pub fn from_path(path: impl AsRef<Path>) -> Result<Self>
pub fn world_size(&self) -> u32
pub fn backend(&self) -> Result<TransportBackend>
Sourcepub fn peers(&self) -> Result<Vec<SocketAddr>>
pub fn peers(&self) -> Result<Vec<SocketAddr>>
Resolve every hosts[r] entry to a single SocketAddr, in rank
order.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Hostfile
impl<'de> Deserialize<'de> for Hostfile
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 Hostfile
impl RefUnwindSafe for Hostfile
impl Send for Hostfile
impl Sync for Hostfile
impl Unpin for Hostfile
impl UnsafeUnpin for Hostfile
impl UnwindSafe for Hostfile
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