pub struct School {
pub name: String,
pub degrees: Vec<Degree>,
pub plans: Vec<Plan>,
/* private fields */
}Expand description
Represents an educational institution
Fields§
§name: StringSchool name
degrees: Vec<Degree>Degrees offered by the school
plans: Vec<Plan>Curriculum plans offered by the school
Implementations§
Source§impl School
impl School
Sourcepub fn add_course(&mut self, course: Course) -> bool
pub fn add_course(&mut self, course: Course) -> bool
Add a course to the school
§Arguments
course- Course to add
§Returns
true if the course was added, false if a course with that key already exists
Add a course to the school (fails if key already exists)
§Arguments
course- The course to add
§Returns
true if the course was added, false if a course with the same key already exists
Sourcepub fn add_course_with_key(&mut self, key: String, course: Course)
pub fn add_course_with_key(&mut self, key: String, course: Course)
Add a course with a custom key (for handling deduplication)
§Arguments
key- Custom key for the coursecourse- The course to add
Sourcepub fn get_course(&self, storage_key: &str) -> Option<&Course>
pub fn get_course(&self, storage_key: &str) -> Option<&Course>
Sourcepub fn get_course_by_natural_key(&self, natural_key: &str) -> Option<&Course>
pub fn get_course_by_natural_key(&self, natural_key: &str) -> Option<&Course>
Sourcepub fn get_storage_key(&self, natural_key: &str) -> Option<String>
pub fn get_storage_key(&self, natural_key: &str) -> Option<String>
Sourcepub fn get_course_mut(&mut self, key: &str) -> Option<&mut Course>
pub fn get_course_mut(&mut self, key: &str) -> Option<&mut Course>
Sourcepub fn courses_with_keys(&self) -> impl Iterator<Item = (&String, &Course)>
pub fn courses_with_keys(&self) -> impl Iterator<Item = (&String, &Course)>
Sourcepub fn add_degree(&mut self, degree: Degree)
pub fn add_degree(&mut self, degree: Degree)
Add a degree to the school
Sourcepub fn get_degree(&self, degree_id: &str) -> Option<&Degree>
pub fn get_degree(&self, degree_id: &str) -> Option<&Degree>
Sourcepub fn get_plans_for_degree(&self, degree_id: &str) -> Vec<&Plan>
pub fn get_plans_for_degree(&self, degree_id: &str) -> Vec<&Plan>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for School
impl<'de> Deserialize<'de> for School
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
Auto Trait Implementations§
impl Freeze for School
impl RefUnwindSafe for School
impl Send for School
impl Sync for School
impl Unpin for School
impl UnwindSafe for School
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