zaciatok
This commit is contained in:
72
src/lib.rs
72
src/lib.rs
@@ -1,2 +1,74 @@
|
|||||||
// src/lib.rs
|
// src/lib.rs
|
||||||
|
|
||||||
|
use serde::{Serialize, Deserialize};
|
||||||
|
|
||||||
|
#[derive(Default, Serialize, Deserialize, PartialEq)]
|
||||||
|
enum Semester {
|
||||||
|
#[default]
|
||||||
|
Zimny,
|
||||||
|
Letny
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Serialize, Deserialize, PartialEq, Eq, Hash, Copy, Clone)]
|
||||||
|
enum TypPovinnosti {
|
||||||
|
Povinny,
|
||||||
|
PovinneVoliteny,
|
||||||
|
#[default]
|
||||||
|
Vyberovy,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Serialize, Deserialize)]
|
||||||
|
struct Predmet {
|
||||||
|
kod: String,
|
||||||
|
nazov: String,
|
||||||
|
vyucujuci: Vec<String>,
|
||||||
|
popis: String,
|
||||||
|
semester: Semester,
|
||||||
|
rocnik: u8,
|
||||||
|
pocet_kreditov: u8,
|
||||||
|
znamka: char,
|
||||||
|
typ_povinnosti: TypPovinnosti
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Serialize, Deserialize)]
|
||||||
|
struct Index {
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Index{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Predmet {
|
||||||
|
pub fn new(
|
||||||
|
kod: String,
|
||||||
|
nazov: String,
|
||||||
|
vyucujuci: Vec<String>,
|
||||||
|
popis: String,
|
||||||
|
semester: Semester,
|
||||||
|
rocnik: u8,
|
||||||
|
pocet_kreditov: u8,
|
||||||
|
znamka: char,
|
||||||
|
typ_povinnosti: TypPovinnosti
|
||||||
|
) -> Self{
|
||||||
|
return Self {
|
||||||
|
kod: kod.to_string(),
|
||||||
|
nazov: nazov.to_string(),
|
||||||
|
vyucujuci,
|
||||||
|
popis: popis.to_string(),
|
||||||
|
semester,
|
||||||
|
rocnik,
|
||||||
|
pocet_kreditov,
|
||||||
|
znamka,
|
||||||
|
typ_povinnosti,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// kod: &str,
|
||||||
|
// nazov: &str,
|
||||||
|
// vyucujuci: Vec<String>,
|
||||||
|
// popis: &str,
|
||||||
|
// semester: Semester,
|
||||||
|
// rocnik: u8,
|
||||||
|
// pocet_kreditov: u8,
|
||||||
|
// znamka: char,
|
||||||
|
// typ_povinnosti: TypPovinnosti
|
||||||
|
|||||||
Reference in New Issue
Block a user