pub struct Choice { /* private fields */ }Expand description
A choice among ordered named outcomes.
Implementations§
Source§impl Choice
impl Choice
Sourcepub fn new(
text: impl Into<String>,
options: IndexMap<String, Option<String>>,
) -> Result<Self, Error>
pub fn new( text: impl Into<String>, options: IndexMap<String, Option<String>>, ) -> Result<Self, Error>
Validate instructions and at least two distinct nonempty option names.
§Errors
Returns InvalidQuestion for blank instructions, fewer than two options,
or an empty option name. The ordered map supplies unique names.
Source§impl Choice
impl Choice
Sourcepub fn instructions(&self) -> &str
pub fn instructions(&self) -> &str
Original instructions, preserved without trimming.
Sourcepub fn min_confidence(&self) -> f64
pub fn min_confidence(&self) -> f64
Minimum confidence required for a decision.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Choice
impl<'de> Deserialize<'de> for Choice
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Choice
Auto Trait Implementations§
impl Freeze for Choice
impl RefUnwindSafe for Choice
impl Send for Choice
impl Sync for Choice
impl Unpin for Choice
impl UnsafeUnpin for Choice
impl UnwindSafe for Choice
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