[][src]Struct rubric::rubric::criterion_builder::CriterionBuilder

pub struct CriterionBuilder { /* fields omitted */ }

A builder struct that builds a Criterion. You should create one of these through Criterion::new instead of directly.

Implementations

impl CriterionBuilder[src]

pub fn new(name: &str) -> Self[src]

Creates a new CriterionBuilder

let builder = CriterionBuilder::new("my crit").build();

pub fn func(self, func: &str) -> Self[src]

Sets the function name of a criterion.

This only assigns the function name, not the actual function. Use the attach! macro or test() method to attach the function.

A function name should conform to rust standards, ie. should be lowercase and not contain whitespace. I use snake_case, but camelCase will also work

let crit = CriterionBuilder::new("my crit")
    .func("my_func")
    .build();

pub fn index(self, index: i64) -> Self[src]

Sets the index

pub fn test(self, test: Box<dyn Fn(&TestData) -> bool>) -> Self[src]

Attaches a test.

fn my_test(_: &TestData) -> bool {
    true
}

let crit = CriterionBuilder::new("my crit")
    .test(Box::new(my_test))
    .build();

pub fn messages(self, success: &str, failure: &str) -> Self[src]

Sets the messages of a criterion.

let crit = CriterionBuilder::new("my crit")
    .messages("passed", "failed")
    .build();

pub fn desc(self, desc: &str) -> Self[src]

Sets the description of a criterion. It should be relatively short.

let crit = CriterionBuilder::new("Git installed")
    .desc("Tests that Git is installed")
    .build();

pub fn worth(self, worth: isize) -> Self[src]

Sets the worth on a Criterion

pub fn hide(self, hide: bool) -> Self[src]

Sets the hide flag on a criterion. If hide is true, the criterion can't be printed.

let crit = CriterionBuilder::new("my crit")
    .hide(true)
    .build();

pub fn build(self) -> Criterion[src]

Finalizes the criterion.

If a function name wasn't manually set, it will create one based on the name. It will lowercase it, then replace all whitespace with underscores.

let crit = CriterionBuilder::new("my crit")
    // more configuration options...
    .build();

Auto Trait Implementations

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> Same<T> for T

type Output = T

Should always be Self

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

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