1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use necsim_partitioning_core::partition::PartitionSize;

use crate::args::{
    config::{partitioning::Partitioning, pause::Pause},
    utils::parse::try_parse_state,
};

use super::super::BufferingSimulateArgsBuilder;

pub(in super::super) fn parse_and_normalise(
    ron_args: &str,
    normalised_args: &mut BufferingSimulateArgsBuilder,
    partitioning: &Partitioning,
) -> anyhow::Result<Option<Pause>> {
    let SimulateArgsPauseOnly { pause } =
        try_parse_state("simulate", ron_args, &mut partitioning.get_size())?;

    normalised_args.pause(&pause);

    Ok(pause)
}

#[derive(DeserializeState)]
#[serde(deserialize_state = "PartitionSize")]
#[serde(rename = "Simulate")]
struct SimulateArgsPauseOnly {
    #[serde(default)]
    #[serde(deserialize_state)]
    pause: Option<Pause>,
}