DialogStep

Struct DialogStep 

Source
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: String

Name 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: bool

Whether to continue on timeout.

§next: Option<String>

Next step name (for branching).

§branches: HashMap<String, String>

Conditional branches.

Implementations§

Source§

impl DialogStep

Source

pub fn new(name: impl Into<String>) -> Self

Create a new step with a name.

Source

pub fn expect(pattern: impl Into<String>) -> Self

Create a step that expects a pattern (simple unnamed step).

Source

pub fn send(text: impl Into<String>) -> Self

Create a step that sends text (simple unnamed step).

Source

pub fn with_expect(self, pattern: impl Into<String>) -> Self

Chain: set the pattern to expect (builder pattern).

Source

pub fn with_send(self, text: impl Into<String>) -> Self

Chain: set the text to send (builder pattern).

Source

pub const fn with_send_control(self, ctrl: ControlChar) -> Self

Chain: set a control character to send (e.g., Ctrl+C).

Source

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.

Source

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.

Source

pub const fn timeout(self, timeout: Duration) -> Self

Set the timeout for this step.

Source

pub fn then(self, next: impl Into<String>) -> Self

Set the next step name.

Source

pub fn branch(self, pattern: impl Into<String>, step: impl Into<String>) -> Self

Add a conditional branch.

Source

pub const fn continue_on_timeout(self, cont: bool) -> Self

Set whether to continue on timeout.

Source

pub fn expect_pattern(&self) -> Option<&str>

Get the expect pattern.

Source

pub fn send_text(&self) -> Option<&str>

Get the send text.

Source

pub const fn send_control(&self) -> Option<ControlChar>

Get the control character to send.

Source

pub const fn get_timeout(&self) -> Option<Duration>

Get the timeout.

Source

pub const fn continues_on_timeout(&self) -> bool

Check if should continue on timeout.

Trait Implementations§

Source§

impl Clone for DialogStep

Source§

fn clone(&self) -> DialogStep

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DialogStep

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DialogStep

Source§

fn default() -> DialogStep

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V