pub struct OneOfQuestion {
pub variants: Vec<Variant>,
pub default: Option<usize>,
}Expand description
Configuration for a OneOf question (choose exactly one variant).
Used for enums where the user selects one variant, then answers any follow-up questions for that variant.
Fields§
§variants: Vec<Variant>The available variants to choose from.
default: Option<usize>Default selected variant index (if any).
Implementations§
Source§impl OneOfQuestion
impl OneOfQuestion
Sourcepub fn new(variants: Vec<Variant>) -> Self
pub fn new(variants: Vec<Variant>) -> Self
Create a new OneOf question with the given variants.
Sourcepub fn with_default(variants: Vec<Variant>, default: usize) -> Self
pub fn with_default(variants: Vec<Variant>, default: usize) -> Self
Create with a default selection.
Sourcepub fn variants_mut(&mut self) -> &mut Vec<Variant>
pub fn variants_mut(&mut self) -> &mut Vec<Variant>
Get a mutable reference to the variants.
Trait Implementations§
Source§impl Clone for OneOfQuestion
impl Clone for OneOfQuestion
Source§fn clone(&self) -> OneOfQuestion
fn clone(&self) -> OneOfQuestion
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 Debug for OneOfQuestion
impl Debug for OneOfQuestion
Source§impl PartialEq for OneOfQuestion
impl PartialEq for OneOfQuestion
impl StructuralPartialEq for OneOfQuestion
Auto Trait Implementations§
impl Freeze for OneOfQuestion
impl RefUnwindSafe for OneOfQuestion
impl Send for OneOfQuestion
impl Sync for OneOfQuestion
impl Unpin for OneOfQuestion
impl UnwindSafe for OneOfQuestion
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