[−][src]Struct lab_grader::batch::Batch
A bundle of metadata with a set of criteria.
The main purpose of a Batch
is to deserialize criteria from a yaml file. This
struct provides a from_yaml
method that takes yaml data and turns it into a batch.
Fields
name: String
desc: Option<String>
criteria: Criteria
total: isize
Implementations
impl Batch
[src]
pub fn from_yaml(yaml: &str) -> Self
[src]
Builds a Batch from yaml data
This method calls parse()
from the FromStr
. parse()
returns a Result
, and this method just prints the result in a clean way and exits
with exit
. It's just one less thing to unwrap
.
exit
ing from within a library function is usually bad practice, but this will only
exit if the yaml passed in has an error. The yaml you'll write to form a Batch is written
during development, and is embedded in the executable. This means that if you're code compiles,
it can be distributed and this will never exit
.
If you want to deal with the result yourself, call parse
instead of this.
Example
use lab_grader::*; let yaml_data = yaml!("../test_data/test_batch.yml").expect("Couldn't open that file"); let batch = Batch::from_yaml(yaml_data); // Now you've got a batch assert!(batch.name.len() > 1);
pub fn attach(&mut self, stub: &str, func: Box<dyn Fn(&TestData) -> bool>)
[src]
Gets a criterion by stub
pub fn print_short(&self)
[src]
An alternative to printing through println!("{}", batch)
.
This prints a shorted report where each criterion is on it's own line, and only the criterion name and status is printed. The batch description is also hidden.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Batch
impl !Send for Batch
impl !Sync for Batch
impl Unpin for Batch
impl !UnwindSafe for Batch
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, I> AsResult<T, I> for T where
I: Input,
I: Input,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoCollection<T> for T
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
A: Array<Item = T>,
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
A: Array<Item = U>,
F: FnMut(T) -> U,
A: Array<Item = U>,
F: FnMut(T) -> U,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Typeable for T where
T: Any,
T: Any,