Skip to main content

weiss_core/pool/helpers/
human_view.rs

1use anyhow::Result;
2
3use super::super::core::EnvPool;
4
5impl EnvPool {
6    /// Build a redacted, JSON-serialized human decision view for one env.
7    pub fn human_decision_view_json(
8        &mut self,
9        env_index: usize,
10        perspective_seat: Option<u8>,
11    ) -> Result<String> {
12        let num_envs = self.envs.len();
13        let Some(env) = self.envs.get_mut(env_index) else {
14            anyhow::bail!("env_index {env_index} out of bounds (num_envs = {num_envs})");
15        };
16        env.update_action_cache();
17        env.human_decision_view_json(perspective_seat)
18    }
19}