[][src]Struct lab_grader::criteria::Criteria

pub struct Criteria(pub Vec<Criterion>);

The Criteria struct, just a collection of Criterion

Implementations

impl Criteria[src]

pub fn add(&mut self, criterion: Criterion)[src]

Add a Criterion to the collection

pub fn get(&mut self, stub: &str) -> Option<&mut Criterion>[src]

Gets Some(Criterion) that has the given stub. Returns None if there isn't one at that index

Example

let mut crit = Criterion::new("test criterion", 1, ("passed", "failed"), Box::new(|_: &TestData| true));
crit.stub = String::from("test-crit-1");
let mut criteria = Criteria::from(vec![crit]);

assert!(criteria.get("test-crit-1").is_some());
assert!(criteria.get("doesnt-exist").is_none());

pub fn attach(&mut self, stub: &str, func: Box<dyn Fn(&TestData) -> bool>)[src]

pub fn from(criteria: Vec<Criterion>) -> Self[src]

Creates a Criteria collection from a Vec<Criterion>

Example

use lab_grader::*;

let critiera = Criteria::from(vec![
    Criterion::new("name", 1, ("p", "f"), Box::new(|_: &TestData| true))
]);

pub fn len(&self) -> usize[src]

Returns the amount of Criterions in this collection

pub fn total_points(&self) -> usize[src]

Returns the total points value of all the criteria, ie. the maximum score possible for all criteria

This is not a grade, but the maximum possible grade. Only a Submission holds a grade.

pub fn points(&self) -> usize[src]

Returns the amount of points earned

If you haven't graded a submission against these criteria, then this will return 0.

Trait Implementations

impl Display for Criteria[src]

impl FromIterator<Criterion> for Criteria[src]

Auto Trait Implementations

impl !RefUnwindSafe for Criteria

impl !Send for Criteria

impl !Sync for Criteria

impl Unpin for Criteria

impl !UnwindSafe for Criteria

Blanket Implementations

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

impl<T, I> AsResult<T, I> for T where
    I: Input, 

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

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

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

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

impl<T> IntoCollection<T> for T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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<T> Typeable for T where
    T: Any