pub struct Dialog {
pub name: String,
pub description: String,
pub steps: Vec<DialogStep>,
pub entry: Option<String>,
pub variables: HashMap<String, String>,
}Expand description
A complete dialog definition.
Fields§
§name: StringName of the dialog.
description: StringDescription.
steps: Vec<DialogStep>Steps in the dialog.
entry: Option<String>Entry point step name.
variables: HashMap<String, String>Variables for substitution.
Implementations§
Source§impl Dialog
impl Dialog
Sourcepub fn description(self, desc: impl Into<String>) -> Self
pub fn description(self, desc: impl Into<String>) -> Self
Set the description.
Sourcepub fn step(self, step: DialogStep) -> Self
pub fn step(self, step: DialogStep) -> Self
Add a step.
Sourcepub fn variable(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn variable(self, name: impl Into<String>, value: impl Into<String>) -> Self
Set a variable.
Sourcepub fn entry_point(self, step: impl Into<String>) -> Self
pub fn entry_point(self, step: impl Into<String>) -> Self
Set the entry point.
Sourcepub fn steps(&self) -> &[DialogStep]
pub fn steps(&self) -> &[DialogStep]
Get the steps.
Sourcepub fn get_step(&self, name: &str) -> Option<&DialogStep>
pub fn get_step(&self, name: &str) -> Option<&DialogStep>
Get a step by name.
Sourcepub fn substitute(&self, s: &str) -> String
pub fn substitute(&self, s: &str) -> String
Substitute variables in a string.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dialog
impl RefUnwindSafe for Dialog
impl Send for Dialog
impl Sync for Dialog
impl Unpin for Dialog
impl UnwindSafe for Dialog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more