pub struct Noul {
pub instructions: Option<Value>,
pub criteria: Option<NoulCriteria>,
}Expand description
A yes/no question, answered with the probability of yes.
let spam = Noul::new("Is this message spam?")
.criteria_true("Unsolicited advertising")
.criteria_false("A legitimate conversation");Instructions and criteria are optional on the wire; both accept strings, objects, or arrays for advanced structure.
Fields§
§instructions: Option<Value>The question or statement to evaluate: string, object, or array.
criteria: Option<NoulCriteria>Optional descriptions of what counts as yes and no.
Implementations§
Source§impl Noul
impl Noul
Sourcepub fn new(instructions: impl Into<Value>) -> Self
pub fn new(instructions: impl Into<Value>) -> Self
Creates a noul question with instructions and no criteria.
Sourcepub fn without_instructions() -> Self
pub fn without_instructions() -> Self
Creates a noul question with no instructions and no criteria.
Sourcepub fn instructions(self, instructions: impl Into<Value>) -> Self
pub fn instructions(self, instructions: impl Into<Value>) -> Self
Replaces the instructions.
Sourcepub fn criteria(
self,
true_: Option<impl Into<Value>>,
false_: Option<impl Into<Value>>,
) -> Self
pub fn criteria( self, true_: Option<impl Into<Value>>, false_: Option<impl Into<Value>>, ) -> Self
Replaces the criteria from optional true/false descriptions.
Some(value) sends that side; None omits it. Pass
Some(Value::Null) to send an explicit null for a side.
let urgent = Noul::new("Is this urgent?")
.criteria(Some("Time-sensitive"), None::<&str>);Sourcepub fn criteria_value(self, criteria: NoulCriteria) -> Self
pub fn criteria_value(self, criteria: NoulCriteria) -> Self
Replaces the criteria from a NoulCriteria value directly.
Sourcepub fn criteria_true(self, true_: impl Into<Value>) -> Self
pub fn criteria_true(self, true_: impl Into<Value>) -> Self
Sets the “what counts as yes” side of the criteria, leaving the false side unset.
Sourcepub fn criteria_false(self, false_: impl Into<Value>) -> Self
pub fn criteria_false(self, false_: impl Into<Value>) -> Self
Sets the “what counts as no” side of the criteria, leaving the true side unset.