aboutsummaryrefslogtreecommitdiffstats
path: root/src/schema.rs
diff options
context:
space:
mode:
authorYigit Sever2021-04-15 23:25:21 +0300
committerYigit Sever2021-04-15 23:25:21 +0300
commit3bc3897b7de5febebfa654c9a686cdda5501ecba (patch)
treeb7d946793d5f2811f27d1a01c14fe9a78438ccc5 /src/schema.rs
parent8c2b7ebe1e98b88ddbb07a68dc8e54b7c5047379 (diff)
downloadgradecoin-3bc3897b7de5febebfa654c9a686cdda5501ecba.tar.gz
gradecoin-3bc3897b7de5febebfa654c9a686cdda5501ecba.tar.bz2
gradecoin-3bc3897b7de5febebfa654c9a686cdda5501ecba.zip
Add Doc for User
Diffstat (limited to 'src/schema.rs')
-rw-r--r--src/schema.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/schema.rs b/src/schema.rs
index dca0eef..79fee2d 100644
--- a/src/schema.rs
+++ b/src/schema.rs
@@ -175,7 +175,11 @@ impl Default for Block {
175 } 175 }
176} 176}
177 177
178/// Simply a Student 178/// A Student
179///
180/// * [`user_id`]: Can only be one of the repopulated
181/// * [`public_key`]: A PEM format public key "---- BEGIN" and all
182/// * [`balance`]: User's current Gradecoin amount
179#[derive(Serialize, Deserialize, Debug, PartialEq)] 183#[derive(Serialize, Deserialize, Debug, PartialEq)]
180pub struct User { 184pub struct User {
181 pub user_id: MetuId, 185 pub user_id: MetuId,
@@ -253,10 +257,7 @@ impl fmt::Display for MetuId {
253impl MetuId { 257impl MetuId {
254 pub fn new(id: String, pwd: String) -> Option<Self> { 258 pub fn new(id: String, pwd: String) -> Option<Self> {
255 if OUR_STUDENTS.contains(&(&*id, &*pwd)) { 259 if OUR_STUDENTS.contains(&(&*id, &*pwd)) {
256 Some(MetuId { 260 Some(MetuId { id, passwd: pwd })
257 id,
258 passwd: pwd,
259 })
260 } else { 261 } else {
261 None 262 None
262 } 263 }