pub struct Subtask { /* private fields */ }Expand description
This struct represents a subtask. You can add tests, test generators and set a checker function. Once you are done, you can add the subtask to a task.
Implementations§
Source§impl Subtask
impl Subtask
Sourcepub fn add_test<F: Fn() -> String + 'static>(
&mut self,
number: i32,
function: F,
)
pub fn add_test<F: Fn() -> String + 'static>( &mut self, number: i32, function: F, )
This function adds a test generator to the subtask with the provided count. Test generator is a function that returns a string.
Sourcepub fn add_test_str<S: Into<String>>(&mut self, input: S)
pub fn add_test_str<S: Into<String>>(&mut self, input: S)
This function adds a single test from a string.
Sourcepub fn set_checker<F: Fn(Input) -> Result<()> + 'static>(&mut self, function: F)
pub fn set_checker<F: Fn(Input) -> Result<()> + 'static>(&mut self, function: F)
This function sets the checker function for the subtask.
The checker function receives the input and returns an error if the input is invalid.
If the input is valid, it should return Ok(()).
If the checker function is not set, the default checker will be used although it is not recommended.
Auto Trait Implementations§
impl Freeze for Subtask
impl !RefUnwindSafe for Subtask
impl !Send for Subtask
impl !Sync for Subtask
impl Unpin for Subtask
impl !UnwindSafe for Subtask
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