@@ -45,7 +45,6 @@ use crate::CommActor;
45
45
use crate :: Mesh ;
46
46
use crate :: comm:: multicast:: CastMessage ;
47
47
use crate :: comm:: multicast:: CastMessageEnvelope ;
48
- use crate :: comm:: multicast:: DestinationPort ;
49
48
use crate :: comm:: multicast:: Uslice ;
50
49
use crate :: comm:: multicast:: set_cast_info_on_headers;
51
50
use crate :: metrics;
@@ -54,32 +53,31 @@ use crate::reference::ActorMeshId;
54
53
use crate :: reference:: ActorMeshRef ;
55
54
use crate :: reference:: ProcMeshId ;
56
55
57
- /// Common implementation for ActorMeshes and ActorMeshRefs to cast an [`M`]-typed message
56
+ /// Common implementation for `ActorMesh`s and `ActorMeshRef`s to cast
57
+ /// an `M`-typed message
58
58
#[ allow( clippy:: result_large_err) ] // TODO: Consider reducing the size of `CastError`.
59
- pub ( crate ) fn actor_mesh_cast < M : Castable + Clone , A > (
59
+ pub ( crate ) fn actor_mesh_cast < A , M > (
60
60
caps : & impl cap:: CanSend ,
61
61
actor_mesh_id : ActorMeshId ,
62
62
actor_mesh_shape : & Shape ,
63
- _proc_mesh_shape : & Shape ,
64
- actor_name : & str ,
65
63
sender : & ActorId ,
66
64
comm_actor_ref : & ActorRef < CommActor > ,
67
65
selection : Selection ,
68
66
message : M ,
69
67
) -> Result < ( ) , CastError >
70
68
where
71
- A : RemoteHandles < M > + RemoteHandles < IndexedErasedUnbound < M > > ,
69
+ A : RemoteActor + RemoteHandles < IndexedErasedUnbound < M > > ,
70
+ M : Castable + RemoteMessage ,
72
71
{
73
72
let _ = metrics:: ACTOR_MESH_CAST_DURATION . start ( hyperactor:: kv_pairs!(
74
73
"message_type" => M :: typename( ) ,
75
74
"message_variant" => message. arm( ) . unwrap_or_default( ) ,
76
75
) ) ;
77
76
78
77
let slice = actor_mesh_shape. slice ( ) . clone ( ) ;
79
- let message = CastMessageEnvelope :: new (
78
+ let message = CastMessageEnvelope :: new :: < A , M > (
80
79
actor_mesh_id,
81
80
sender. clone ( ) ,
82
- DestinationPort :: new :: < A , M > ( actor_name. to_string ( ) ) ,
83
81
actor_mesh_shape. clone ( ) ,
84
82
message,
85
83
None , // TODO: reducer typehash
@@ -101,30 +99,29 @@ pub trait ActorMesh: Mesh<Id = ActorMeshId> {
101
99
/// The type of actor in the mesh.
102
100
type Actor : RemoteActor ;
103
101
104
- /// Cast an [ `M`] -typed message to the ranks selected by `sel`
105
- /// in this ActorMesh.
102
+ /// Cast an `M`-typed message to the ranks selected by `sel` in
103
+ /// this ActorMesh.
106
104
#[ allow( clippy:: result_large_err) ] // TODO: Consider reducing the size of `CastError`.
107
- fn cast < M : Castable + Clone > ( & self , selection : Selection , message : M ) -> Result < ( ) , CastError >
105
+ fn cast < M > ( & self , selection : Selection , message : M ) -> Result < ( ) , CastError >
108
106
where
109
- Self :: Actor : RemoteHandles < M > + RemoteHandles < IndexedErasedUnbound < M > > ,
107
+ Self :: Actor : RemoteHandles < IndexedErasedUnbound < M > > ,
108
+ M : Castable + RemoteMessage ,
110
109
{
111
- actor_mesh_cast :: < M , Self :: Actor > (
112
- self . proc_mesh ( ) . client ( ) ,
113
- self . id ( ) ,
114
- self . shape ( ) ,
115
- self . proc_mesh ( ) . shape ( ) ,
116
- self . name ( ) ,
117
- self . proc_mesh ( ) . client ( ) . actor_id ( ) ,
118
- self . proc_mesh ( ) . comm_actor ( ) ,
119
- selection,
120
- message,
110
+ actor_mesh_cast :: < Self :: Actor , M > (
111
+ self . proc_mesh ( ) . client ( ) , // send capability
112
+ self . id ( ) , // actor mesh id (destination mesh)
113
+ self . shape ( ) , // actor mesh shape
114
+ self . proc_mesh ( ) . client ( ) . actor_id ( ) , // sender
115
+ self . proc_mesh ( ) . comm_actor ( ) , // comm actor
116
+ selection, // the selected actors
117
+ message, // the message
121
118
)
122
119
}
123
120
124
121
/// The ProcMesh on top of which this actor mesh is spawned.
125
122
fn proc_mesh ( & self ) -> & ProcMesh ;
126
123
127
- /// The name global name of actors in this mesh.
124
+ /// The name given to the actors in this mesh.
128
125
fn name ( & self ) -> & str ;
129
126
130
127
fn world_id ( & self ) -> & WorldId {
0 commit comments