Function ruma::events::poll::compile_unstable_poll_results
source ยท pub fn compile_unstable_poll_results<'a>(
poll: &'a UnstablePollStartContentBlock,
responses: impl IntoIterator<Item = PollResponseData<'a>>,
end_timestamp: Option<MilliSecondsSinceUnixEpoch>,
) -> IndexMap<&'a str, BTreeSet<&'a UserId>>
Available on crate features
events
and unstable-msc3381
only.Expand description
Generate the current results with the given unstable poll and responses.
If the end_timestamp
is provided, any response with an origin_server_ts
after that timestamp
is ignored. If it is not provided, MilliSecondsSinceUnixEpoch::now()
will be used instead.
This method will handle invalid responses, or several response from the same user so all responses to the poll should be provided.
Returns a map of answer ID to a set of user IDs that voted for them. When using .iter()
or
.into_iter()
on the map, the results are sorted from the highest number of votes to the
lowest.