pub struct Request {
pub state: Value,
pub model: Option<String>,
pub questions: Vec<Question>,
pub kime: Option<Map<String, Value>>,
}Expand description
A validated request.
Fields§
§state: ValueThe state, as sent. Never null.
model: Option<String>The requested model, if any.
questions: Vec<Question>The questions in request order.
kime: Option<Map<String, Value>>The kime extension object, not yet interpreted.
Implementations§
Source§impl Request
Building a request in code. Nothing is checked until it is answered, where it goes through
the same validation as a request that came in as JSON.
impl Request
Building a request in code. Nothing is checked until it is answered, where it goes through the same validation as a request that came in as JSON.
Sourcepub fn question(self, q: Question) -> Self
pub fn question(self, q: Question) -> Self
Adds a question, or replaces the one with the same id where it stands, as a repeated key in a JSON object would.
Sourcepub fn choice<L: Into<String>, D: Into<String>>(
self,
id: impl Into<String>,
instructions: impl Into<String>,
options: impl IntoIterator<Item = (L, D)>,
) -> Self
pub fn choice<L: Into<String>, D: Into<String>>( self, id: impl Into<String>, instructions: impl Into<String>, options: impl IntoIterator<Item = (L, D)>, ) -> Self
Adds a choice question, with each option given as a label and its description.
Sourcepub fn score<S: Into<String>>(
self,
id: impl Into<String>,
instructions: impl Into<String>,
levels: impl IntoIterator<Item = S>,
) -> Self
pub fn score<S: Into<String>>( self, id: impl Into<String>, instructions: impl Into<String>, levels: impl IntoIterator<Item = S>, ) -> Self
Adds a score question with its levels, lowest first.
Trait Implementations§
impl StructuralPartialEq for Request
Auto Trait Implementations§
impl Freeze for Request
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnsafeUnpin for Request
impl UnwindSafe for Request
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