pub fn place_message(obs: &mut [f32], offset: usize, tokens: &[i64])Expand description
Write received message tokens into an observation slice starting at
offset, one f32 per token.
This is the receiver-side counterpart to split_action(): after slicing a
sender’s message off its action, the env lays those tokens into the
receiver’s observation vector (the region the env reserves via
CommunicatingEnvironment::message_obs_size). Tokens are written verbatim
as f32, matching the flat host-vector discipline of the observation
surface.
§Panics
Panics if the destination region obs[offset..offset + tokens.len()] would
run past the end of obs, which indicates a message_obs_size / layout
mismatch.
§Examples
use thrust_rl::multi_agent::comms::place_message;
let mut obs = vec![0.0_f32; 4];
place_message(&mut obs, 1, &[3, 2]);
assert_eq!(obs, vec![0.0, 3.0, 2.0, 0.0]);