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): an anyOf
with one closed object per mode, the tag a one-value enum, no $ref,
no pattern, and no numeric or length bounds, so it is valid under
strict tool use (agora CLAUDE.md). Every bound is checked by
PollSpec::check instead, 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.