-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Import necessary libraries | ||
use std::collections::HashMap; | ||
use std::hash::{Hash, Hasher}; | ||
use std::io::{Read, Write}; | ||
use std::ops::{Add, Mul, Sub}; | ||
use std::vec::Vec; | ||
|
||
// Define the Proposal struct | ||
pub struct Proposal { | ||
// Proposal ID | ||
id: u32, | ||
// Proposal title | ||
title: String, | ||
// Proposal description | ||
description: String, | ||
// Proposal status | ||
status: ProposalStatus, | ||
} | ||
|
||
// Implement the Proposal struct | ||
impl Proposal { | ||
// Create a new Proposal | ||
pub fn new(id: u32, title: String, description: String) -> Self { | ||
Proposal { | ||
id, | ||
title, | ||
description, | ||
status: ProposalStatus::Pending, | ||
} | ||
} | ||
} | ||
|
||
// Define the ProposalStatus enum | ||
pub enum ProposalStatus { | ||
Pending, | ||
Voting, | ||
Approved, | ||
Rejected, | ||
} | ||
|
||
// Export the Proposal and ProposalStatus | ||
pub use Proposal; | ||
pub use ProposalStatus; |