Struct spl_governance::state::vote_record::VoteChoice
source · [−]Expand description
Voter choice for a proposal option In the current version only 1) Single choice and 2) Multiple choices proposals are supported In the future versions we can add support for 1) Quadratic voting, 2) Ranked choice voting and 3) Weighted voting
Fields
rank: u8
The rank given to the choice by voter Note: The filed is not used in the current version
weight_percentage: u8
The voter’s weight percentage given by the voter to the choice
Implementations
sourceimpl VoteChoice
impl VoteChoice
sourcepub fn get_choice_weight(&self, voter_weight: u64) -> Result<u64, ProgramError>
pub fn get_choice_weight(&self, voter_weight: u64) -> Result<u64, ProgramError>
Returns the choice weight given the voter’s weight
Trait Implementations
sourceimpl BorshDeserialize for VoteChoice where
u8: BorshDeserialize,
u8: BorshDeserialize,
impl BorshDeserialize for VoteChoice where
u8: BorshDeserialize,
u8: BorshDeserialize,
sourceimpl BorshSchema for VoteChoice where
u8: BorshSchema,
u8: BorshSchema,
impl BorshSchema for VoteChoice where
u8: BorshSchema,
u8: BorshSchema,
sourcefn declaration() -> Declaration
fn declaration() -> Declaration
Get the name of the type without brackets.
sourcefn add_definitions_recursively(
definitions: &mut HashMap<Declaration, Definition>
)
fn add_definitions_recursively(
definitions: &mut HashMap<Declaration, Definition>
)
Recursively, using DFS, add type definitions required for this type. For primitive types this is an empty map. Type definition explains how to serialize/deserialize a type. Read more
sourcefn add_definition(
declaration: String,
definition: Definition,
definitions: &mut HashMap<String, Definition, RandomState>
)
fn add_definition(
declaration: String,
definition: Definition,
definitions: &mut HashMap<String, Definition, RandomState>
)
Helper method to add a single type definition to the map.
fn schema_container() -> BorshSchemaContainer
sourceimpl BorshSerialize for VoteChoice where
u8: BorshSerialize,
u8: BorshSerialize,
impl BorshSerialize for VoteChoice where
u8: BorshSerialize,
u8: BorshSerialize,
sourceimpl Clone for VoteChoice
impl Clone for VoteChoice
sourcefn clone(&self) -> VoteChoice
fn clone(&self) -> VoteChoice
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for VoteChoice
impl Debug for VoteChoice
sourceimpl PartialEq<VoteChoice> for VoteChoice
impl PartialEq<VoteChoice> for VoteChoice
sourcefn eq(&self, other: &VoteChoice) -> bool
fn eq(&self, other: &VoteChoice) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &VoteChoice) -> bool
fn ne(&self, other: &VoteChoice) -> bool
This method tests for !=
.
impl StructuralPartialEq for VoteChoice
Auto Trait Implementations
impl RefUnwindSafe for VoteChoice
impl Send for VoteChoice
impl Sync for VoteChoice
impl Unpin for VoteChoice
impl UnwindSafe for VoteChoice
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
pub default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more