pub enum PollSpec {
Ranked {
options: Vec<PollOptionSpec>,
max_ranks: Option<u16>,
opens_at: Option<DateTime<Utc>>,
closes_at: DateTime<Utc>,
},
Approval {
options: Vec<PollOptionSpec>,
max_choices: Option<u16>,
opens_at: Option<DateTime<Utc>>,
closes_at: DateTime<Utc>,
},
Single {
options: Vec<PollOptionSpec>,
opens_at: Option<DateTime<Utc>>,
closes_at: DateTime<Utc>,
},
}Expand description
A poll to attach to a new post (create_post’s poll), tagged by its
mode. Each mode carries only its own parameters.
Its schema is written by hand (see the JsonSchema impl): one closed
object, mode an enum, and one max_choices that caps the options a
ballot may rank (ranked) or approve (approval), so the poll is
written out once (0.106; it was an anyOf with one object per mode).
ranked reads max_choices as max_ranks, and still reads
max_ranks, so the signed bytes, which serialize max_ranks, are
unchanged. No $ref and no pattern; the bounds are checked by
PollSpec::check too, with an error that says what to fix.
Variants§
Ranked
Ranked choice, counted by instant runoff
Fields
§
options: Vec<PollOptionSpec>Approval
Approval: a ballot names every option its voter approves of
Fields
§
options: Vec<PollOptionSpec>Single
A ballot names exactly one option
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PollSpec
impl<'de> Deserialize<'de> for PollSpec
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 Eq for PollSpec
impl StructuralPartialEq for PollSpec
Auto Trait Implementations§
impl Freeze for PollSpec
impl RefUnwindSafe for PollSpec
impl Send for PollSpec
impl Sync for PollSpec
impl Unpin for PollSpec
impl UnsafeUnpin for PollSpec
impl UnwindSafe for PollSpec
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.