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
use crate::args::{
    config::{pause::Pause, sample::Sample},
    utils::parse::try_parse_state,
};

use super::super::BufferingSimulateArgsBuilder;

pub(in super::super) fn parse_and_normalise<'a>(
    ron_args: &'a str,
    normalised_args: &mut BufferingSimulateArgsBuilder,
    mut pause: &'a Option<Pause>,
) -> anyhow::Result<Sample> {
    let SimulateArgsSampleOnly { sample } = try_parse_state("simulate", ron_args, &mut pause)?;

    normalised_args.sample(&sample);

    Ok(sample)
}

#[derive(DeserializeState)]
#[serde(deserialize_state = "&'de Option<Pause>")]
#[serde(rename = "Simulate")]
struct SimulateArgsSampleOnly {
    #[serde(default)]
    #[serde(deserialize_state)]
    sample: Sample,
}