[][src]Struct matchmaker::Student

pub struct Student {
    pub name: String,
    pub preferences: VecDeque<Category>,
    pub exclude: Vec<Category>,
}

Holds a student

Fields

name: String

Name of the student (must be unique)

preferences: VecDeque<Category>

Categories the student wishes to be placed in, in order of preference

exclude: Vec<Category>

Categories the student wishes not to be placed in

Implementations

impl Student[src]

pub fn new(
    name: &str,
    preferences: VecDeque<Category>,
    exclude: Vec<Category>
) -> Self
[src]

Return a new Student

Arguments

  • name - A &str that holds the name of the student (must be unique)
  • preferences - A VecDeque of Categorys the student wishes to be placed in, in order of preference
  • exclude - A Vec of Categorys the student wishes not to be placed in

Examples

use std::collections::VecDeque;
use matchmaker::{Category, Student};

// Create categories
let cooking = Category::new("Cooking", 10);
let reading = Category::new("Reading", 10);

// Create student Bert
// Bert wishes to be placed in category cooking or reading (in that order)
let bert = Student::new(
    "Bert",
    VecDeque::from(vec![cooking, reading]),
    Vec::new(),
);
use std::collections::VecDeque;
use matchmaker::{Category, Student};

let cooking = Category::new("Cooking", 10);
let reading = Category::new("Reading", 10);
let walking = Category::new("Walking", 5);

// Create student Suze
// Suze wishes to be placed in category cooking or reading (in that order),
// but does not wish to be placed in category walking
let suze = Student::new(
    "Suze",
    VecDeque::from(vec![cooking, reading]),
    Vec::from([walking]),
);

Trait Implementations

impl Clone for Student[src]

impl Debug for Student[src]

impl<'de> Deserialize<'de> for Student[src]

impl Eq for Student[src]

impl Ord for Student[src]

impl PartialEq<Student> for Student[src]

impl PartialOrd<Student> for Student[src]

impl Serialize for Student[src]

impl StructuralEq for Student[src]

Auto Trait Implementations

impl RefUnwindSafe for Student

impl Send for Student

impl Sync for Student

impl Unpin for Student

impl UnwindSafe for Student

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,