@@ -179,19 +179,20 @@ pub(crate) struct ForwardMessage {
179
179
}
180
180
181
181
declare_attrs ! {
182
- /// Used inside headers for cast messages to store
183
- /// the rank of the receiver.
184
- attr CAST_RANK : usize ;
185
- /// Used inside headers to store the shape of the
186
- /// actor mesh that a message was cast to.
187
- attr CAST_SHAPE : Shape ;
182
+ /// Casting metadata comprising:
183
+ /// 1) the rank of the receiver in the mesh,
184
+ /// 2) the shape of the mesh on which the message is being cast.
185
+ ///
186
+ /// The mesh here is the root mesh -- i.e., the shape is the extents
187
+ /// of the mesh on which the actors were spawned.
188
+ attr CAST_INFO : ( usize , Shape ) ;
189
+
188
190
/// Used inside headers to store the originating sender of a cast.
189
191
pub attr CAST_ORIGINATING_SENDER : ActorId ;
190
192
}
191
193
192
194
pub fn set_cast_info_on_headers ( headers : & mut Attrs , rank : usize , shape : Shape , sender : ActorId ) {
193
- headers. set ( CAST_RANK , rank) ;
194
- headers. set ( CAST_SHAPE , shape) ;
195
+ headers. set ( CAST_INFO , ( rank, shape) ) ;
195
196
headers. set ( CAST_ORIGINATING_SENDER , sender) ;
196
197
}
197
198
@@ -206,10 +207,9 @@ pub trait CastInfo {
206
207
impl < A : Actor > CastInfo for Context < ' _ , A > {
207
208
fn cast_info ( & self ) -> ( usize , Shape ) {
208
209
let headers = self . headers ( ) ;
209
- match ( headers. get ( CAST_RANK ) , headers. get ( CAST_SHAPE ) ) {
210
- ( Some ( rank) , Some ( shape) ) => ( * rank, shape. clone ( ) ) ,
211
- ( None , None ) => ( 0 , Shape :: unity ( ) ) ,
212
- _ => panic ! ( "Expected either both rank and shape or neither" ) ,
210
+ match headers. get ( CAST_INFO ) {
211
+ Some ( ( rank, shape) ) => ( * rank, shape. clone ( ) ) ,
212
+ None => ( 0 , Shape :: unity ( ) ) ,
213
213
}
214
214
}
215
215
}
0 commit comments