Skip to main content

vote

Function vote 

Source
pub fn vote(
    layout: &Layout,
    id: &str,
    choice: Option<&str>,
    identity: &str,
) -> Result<String>
Expand description

Cast or change one agent’s vote, or read the tally when choice is None. One ballot per identity, a recast replaces it, and the read-modify-write runs under the file lock. Stored as a :VOTES: drawer on the heading.

§Errors

Returns an error if id is not in the corpus, choice is blank, or the file cannot be rewritten.