ruma_events/poll/start/
poll_answers_serde.rs
1use serde::Deserialize;
4
5use super::{PollAnswer, PollAnswers, PollAnswersError};
6
7#[derive(Debug, Default, Deserialize)]
8pub(crate) struct PollAnswersDeHelper(Vec<PollAnswer>);
9
10impl TryFrom<PollAnswersDeHelper> for PollAnswers {
11 type Error = PollAnswersError;
12
13 fn try_from(helper: PollAnswersDeHelper) -> Result<Self, Self::Error> {
14 let mut answers = helper.0;
15 answers.truncate(PollAnswers::MAX_LENGTH);
16 PollAnswers::try_from(answers)
17 }
18}