pub struct PromptContext<'a> {
pub kind: PromptKind,
pub message: &'a str,
pub options: Option<usize>,
}Expand description
Context the source passes to a PromptResponder.
Includes everything a smart responder might want: the prompt kind, the
human-facing message (for diagnostic / advanced matching), and — for
finite-choice prompts — the size of the option list so a Choice(i)
response can be range-checked.
Fields§
§kind: PromptKindWhat kind of prompt is asking.
message: &'a strThe human-facing prompt message (e.g. "Pack name:").
Mostly useful for diagnostics in panic messages and for advanced responders that want to match on text. Position-based scripted responders don’t need to consult it.
options: Option<usize>Size of the option list, for Select / MultiSelect. None for
open prompts and confirm.
Trait Implementations§
Source§impl<'a> Clone for PromptContext<'a>
impl<'a> Clone for PromptContext<'a>
Source§fn clone(&self) -> PromptContext<'a>
fn clone(&self) -> PromptContext<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for PromptContext<'a>
impl<'a> Debug for PromptContext<'a>
impl<'a> Copy for PromptContext<'a>
Auto Trait Implementations§
impl<'a> Freeze for PromptContext<'a>
impl<'a> RefUnwindSafe for PromptContext<'a>
impl<'a> Send for PromptContext<'a>
impl<'a> Sync for PromptContext<'a>
impl<'a> Unpin for PromptContext<'a>
impl<'a> UnsafeUnpin for PromptContext<'a>
impl<'a> UnwindSafe for PromptContext<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more