pub struct Mesh { /* private fields */ }
Expand description
Represents a mesh::Node with the ability to spawn new processes that can communicate with any other process belonging to the same mesh.
§Process creation
A Mesh
instance can spawn new processes with an initial communication
channel associated with the mesh. All processes originating from the same
mesh can potentially communicate and exchange channels with each other.
Each spawned process can be configured differently via ProcessConfig
.
Processes are created with Mesh::launch_host
.
let mesh = Mesh::new("remote_mesh".to_string()).unwrap();
let (send, recv) = mesh::channel();
mesh.launch_host(ProcessConfig::new("test"), recv).await.unwrap();
send.send(String::from("message for new process"));
Implementations§
Source§impl Mesh
impl Mesh
Sourcepub async fn launch_host<T: 'static + MeshField + Send>(
&self,
config: ProcessConfig,
initial_message: T,
) -> Result<()>
pub async fn launch_host<T: 'static + MeshField + Send>( &self, config: ProcessConfig, initial_message: T, ) -> Result<()>
Spawns a new host in the mesh with the provided configuration and initial message.
The initial message will be provided to the closure passed to
try_run_mesh_host()
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Mesh
impl !RefUnwindSafe for Mesh
impl Send for Mesh
impl Sync for Mesh
impl Unpin for Mesh
impl !UnwindSafe for Mesh
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