pub struct RawQuestion<'a> { /* private fields */ }Expand description
A question of a type, or with fields, that this version of the SDK does not model.
It is a JSON object built field by field: type is set by
new, and every field is encoded when it is
given and sent unread. Setting a field again replaces its value and keeps
its position, type included.
Questions::prepare applies the checks the API’s own shape makes
possible without knowing the type: type is a nonempty string, a choice
or score has criteria, and a score’s criteria is not empty.
Everything else is left to the server.
use typesafe_sdk::question::RawQuestion;
let spam = RawQuestion::new("noul").field("instructions", "Spam?").field("weight", 3);Implementations§
Source§impl<'a> RawQuestion<'a>
impl<'a> RawQuestion<'a>
Sourcepub fn field(self, name: impl Into<Cow<'a, str>>, value: impl Serialize) -> Self
pub fn field(self, name: impl Into<Cow<'a, str>>, value: impl Serialize) -> Self
Sets the field name to the JSON form of value.
A value that cannot be encoded - a map whose keys are neither strings,
booleans nor numbers, or a Serialize implementation that fails - is
not stored, and Questions::prepare reports it.
Trait Implementations§
Source§impl<'a> Clone for RawQuestion<'a>
impl<'a> Clone for RawQuestion<'a>
Source§impl<'a> Debug for RawQuestion<'a>
impl<'a> Debug for RawQuestion<'a>
impl<'a> Eq for RawQuestion<'a>
Source§impl<'a> From<RawQuestion<'a>> for Question<'a>
impl<'a> From<RawQuestion<'a>> for Question<'a>
Source§fn from(question: RawQuestion<'a>) -> Self
fn from(question: RawQuestion<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> PartialEq for RawQuestion<'a>
impl<'a> PartialEq for RawQuestion<'a>
impl<'a> StructuralPartialEq for RawQuestion<'a>
Auto Trait Implementations§
impl<'a> Freeze for RawQuestion<'a>
impl<'a> RefUnwindSafe for RawQuestion<'a>
impl<'a> Send for RawQuestion<'a>
impl<'a> Sync for RawQuestion<'a>
impl<'a> Unpin for RawQuestion<'a>
impl<'a> UnsafeUnpin for RawQuestion<'a>
impl<'a> UnwindSafe for RawQuestion<'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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.