pub struct DialogStep {
pub name: String,
pub expect: Option<String>,
pub send: Option<String>,
pub send_control: Option<ControlChar>,
pub timeout: Option<Duration>,
pub continue_on_timeout: bool,
pub next: Option<String>,
pub branches: HashMap<String, String>,
}Expand description
A dialog step definition.
Fields§
§name: StringName of this step (optional for simple dialogs).
expect: Option<String>Pattern to expect.
send: Option<String>Response to send.
send_control: Option<ControlChar>Control character to send (alternative to text).
timeout: Option<Duration>Timeout for this step.
continue_on_timeout: boolWhether to continue on timeout.
next: Option<String>Next step name (for branching).
branches: HashMap<String, String>Conditional branches.
Implementations§
Source§impl DialogStep
impl DialogStep
Sourcepub fn expect(pattern: impl Into<String>) -> Self
pub fn expect(pattern: impl Into<String>) -> Self
Create a step that expects a pattern (simple unnamed step).
Sourcepub fn send(text: impl Into<String>) -> Self
pub fn send(text: impl Into<String>) -> Self
Create a step that sends text (simple unnamed step).
Sourcepub fn with_expect(self, pattern: impl Into<String>) -> Self
pub fn with_expect(self, pattern: impl Into<String>) -> Self
Chain: set the pattern to expect (builder pattern).
Sourcepub fn with_send(self, text: impl Into<String>) -> Self
pub fn with_send(self, text: impl Into<String>) -> Self
Chain: set the text to send (builder pattern).
Sourcepub const fn with_send_control(self, ctrl: ControlChar) -> Self
pub const fn with_send_control(self, ctrl: ControlChar) -> Self
Chain: set a control character to send (e.g., Ctrl+C).
Sourcepub fn then_send(self, text: impl Into<String>) -> Self
pub fn then_send(self, text: impl Into<String>) -> Self
Chain: set the text to send after expecting.
Alias for with_send, for fluent API.
Sourcepub const fn then_send_control(self, ctrl: ControlChar) -> Self
pub const fn then_send_control(self, ctrl: ControlChar) -> Self
Chain: set a control character to send after expecting.
Alias for with_send_control, for fluent API.
Sourcepub fn branch(self, pattern: impl Into<String>, step: impl Into<String>) -> Self
pub fn branch(self, pattern: impl Into<String>, step: impl Into<String>) -> Self
Add a conditional branch.
Sourcepub const fn continue_on_timeout(self, cont: bool) -> Self
pub const fn continue_on_timeout(self, cont: bool) -> Self
Set whether to continue on timeout.
Sourcepub fn expect_pattern(&self) -> Option<&str>
pub fn expect_pattern(&self) -> Option<&str>
Get the expect pattern.
Sourcepub const fn send_control(&self) -> Option<ControlChar>
pub const fn send_control(&self) -> Option<ControlChar>
Get the control character to send.
Sourcepub const fn get_timeout(&self) -> Option<Duration>
pub const fn get_timeout(&self) -> Option<Duration>
Get the timeout.
Sourcepub const fn continues_on_timeout(&self) -> bool
pub const fn continues_on_timeout(&self) -> bool
Check if should continue on timeout.
Trait Implementations§
Source§impl Clone for DialogStep
impl Clone for DialogStep
Source§fn clone(&self) -> DialogStep
fn clone(&self) -> DialogStep
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more