Skip to main content

calandria_sim/script/
step.rs

1//! One exact expected request and its finite response plan.
2
3use super::Plan;
4
5/// One exact scripted request and its owned response plan.
6#[derive(Clone, Debug, Eq, PartialEq)]
7pub struct ScriptStep<Q, R> {
8    expected: Q,
9    response: Plan<R>,
10}
11
12impl<Q, R> ScriptStep<Q, R> {
13    /// Creates one exact script step.
14    pub const fn new(expected: Q, response: Plan<R>) -> Self {
15        Self { expected, response }
16    }
17
18    /// Borrows the exact expected request.
19    pub const fn expected(&self) -> &Q {
20        &self.expected
21    }
22
23    /// Borrows the finite response plan.
24    pub const fn response(&self) -> &Plan<R> {
25        &self.response
26    }
27
28    pub(super) fn into_parts(self) -> (Q, Plan<R>) {
29        (self.expected, self.response)
30    }
31}