Struct JavaConfig

Source
pub struct JavaConfig { /* private fields */ }
Expand description

This struct represents a configuration for running a java program.

See JavaConfig::from_toml for docs on how to create one.

Implementations§

Source§

impl JavaConfig

Source

pub fn from_toml(conf: &Value) -> Result<JavaConfig, &'static str>

Required fields in the toml:

  • “name”: A name for this test
  • “tests_dir”: The directory to contain input and output data
  • “main_class”: The class containing a public static void main(String[] args) method to be run.

Optional fields in the toml:

  • “timeout”: Should be the number of seconds to allow before timing out, true (use default timeout value), or false (allow tested code to run however long it takes - not recommended). Default: 5 seconds
  • “args”: Should be an array of arguments to pass to the java program being tested. It will be passed directly to the String[] args in the java program. Default: empty array.

Trait Implementations§

Source§

impl Config for JavaConfig

Source§

fn name(&self) -> &str

A name for this set of tests
Source§

fn test_type(&self) -> TestType<'_>

The kind of test to run (see TestType for options)
Source§

fn case_timeout(&self) -> &Option<Duration>

The amount of time to let code run before timing out
Source§

fn command(&self) -> &str

The name of the command to run.
Source§

fn args(&self) -> &[&str]

The arguments to be passed to the command.
Source§

fn setup(&self) -> &[&str]

A list of commands to be run in the student’s code directory before running the code.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.