summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYigit Sever2021-04-15 23:25:21 +0300
committerYigit Sever2021-04-15 23:25:21 +0300
commit7d8b9272f885c2a240867f45e7abccc98ebf18f7 (patch)
tree571c5e5c719426e4963bf3aea2d4b5124db5b919 /src
parent44116fd9d5003f4aa041b72491e26356ed47b924 (diff)
downloadgradecoin-7d8b9272f885c2a240867f45e7abccc98ebf18f7.tar.gz
gradecoin-7d8b9272f885c2a240867f45e7abccc98ebf18f7.tar.bz2
gradecoin-7d8b9272f885c2a240867f45e7abccc98ebf18f7.zip
Add Doc for User
Diffstat (limited to 'src')
-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 }