pub struct Vote {
pub id: Uuid,
pub resolution_id: Uuid,
pub owner_id: Uuid,
pub unit_id: Uuid,
pub vote_choice: VoteChoice,
pub voting_power: f64,
pub proxy_owner_id: Option<Uuid>,
pub voted_at: DateTime<Utc>,
}Expand description
Vote d’un propriétaire sur une résolution
Fields§
§id: Uuid§resolution_id: Uuid§owner_id: Uuid§unit_id: Uuid§vote_choice: VoteChoice§voting_power: f64§proxy_owner_id: Option<Uuid>§voted_at: DateTime<Utc>Implementations§
Source§impl Vote
impl Vote
Sourcepub fn new(
resolution_id: Uuid,
owner_id: Uuid,
unit_id: Uuid,
vote_choice: VoteChoice,
voting_power: f64,
proxy_owner_id: Option<Uuid>,
) -> Result<Self, String>
pub fn new( resolution_id: Uuid, owner_id: Uuid, unit_id: Uuid, vote_choice: VoteChoice, voting_power: f64, proxy_owner_id: Option<Uuid>, ) -> Result<Self, String>
Crée un nouveau vote
Sourcepub fn is_proxy_vote(&self) -> bool
pub fn is_proxy_vote(&self) -> bool
Vérifie si le vote est exprimé par procuration
Sourcepub fn effective_voter_id(&self) -> Uuid
pub fn effective_voter_id(&self) -> Uuid
Retourne l’ID du votant effectif (propriétaire ou mandataire)
Sourcepub fn change_vote(&mut self, new_choice: VoteChoice) -> Result<(), String>
pub fn change_vote(&mut self, new_choice: VoteChoice) -> Result<(), String>
Modifie le choix de vote (seulement si pas encore enregistré)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Vote
impl<'de> Deserialize<'de> for Vote
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
Source§impl From<Vote> for VoteResponse
impl From<Vote> for VoteResponse
impl StructuralPartialEq for Vote
Auto Trait Implementations§
impl Freeze for Vote
impl RefUnwindSafe for Vote
impl Send for Vote
impl Sync for Vote
impl Unpin for Vote
impl UnwindSafe for Vote
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<T> Chain<T> for T
impl<T> Chain<T> for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.