Struct Arguments

Source
pub struct Arguments {
Show 24 fields pub include_ignored: bool, pub ignored: bool, pub exclude_should_panic: bool, pub test: bool, pub bench: bool, pub list: bool, pub logfile: Option<String>, pub nocapture: bool, pub test_threads: Option<usize>, pub skip: Vec<String>, pub quiet: bool, pub exact: bool, pub color: Option<ColorSetting>, pub format: Option<FormatSetting>, pub show_output: bool, pub unstable_flags: Option<UnstableFlags>, pub report_time: bool, pub ensure_time: bool, pub shuffle: bool, pub shuffle_seed: Option<u64>, pub show_stats: bool, pub filter: Option<String>, pub ipc: Option<String>, pub spawn_workers: bool,
}
Expand description

Command line arguments.

This type represents everything the user can specify via CLI args. The main method is from_args which reads the global std::env::args() and parses them into this type.

Fields§

§include_ignored: bool

Run ignored and not ignored tests

§ignored: bool

Run only ignored tests

§exclude_should_panic: bool

Excludes tests marked as should_panic

§test: bool

Run tests and not benchmarks

§bench: bool

Run benchmarks instead of tests

§list: bool

List all tests and benchmarks

§logfile: Option<String>

Write logs to the specified file

§nocapture: bool

don’t capture stdout/stderr of each task, allow printing directly

§test_threads: Option<usize>

Number of threads used for running tests in parallel

§skip: Vec<String>

Skip tests whose names contains FILTER (this flag can be used multiple times)

§quiet: bool

Display one character per test instead of one line. Alias to --format=terse

§exact: bool

Exactly match filters rather than by substring

§color: Option<ColorSetting>

Configure coloring of output

§format: Option<FormatSetting>

Configure formatting of output

§show_output: bool

Show captured stdout of successful tests

§unstable_flags: Option<UnstableFlags>

Enable nightly-only flags

§report_time: bool

Show execution time of each test. Threshold values for colorized output can be configured via RUST_TEST_TIME_UNIT, RUST_TEST_TIME_INTEGRATION and RUST_TEST_TIME_DOCTEST environment variables. Expected format of the environment variables is VARIABLE=WARN_TIME,CRITICAL_TIME. Durations must be specified in milliseconds, e.g. 500,2000 means that the warn time is 0.5 seconds, and the critical time is 2 seconds. Not available for --format=terse.

§ensure_time: bool

Treat excess of the test execution time limit as error. Threshold values for this option can be configured via RUST_TEST_TIME_UNIT, RUST_TEST_TIME_INTEGRATION and RUST_TEST_TIME_DOCTEST environment variables. Expected format of the environment variables is VARIABLE=WARN_TIME,CRITICAL_TIME. CRITICAL_TIME here means the limit that should not be exceeded by test.

§shuffle: bool

Run tests in random order

§shuffle_seed: Option<u64>

Run tests in random order; seed the random number generator with SEED

§show_stats: bool

Show detailed benchmark statistics for each benchmark

§filter: Option<String>

The FILTER string is tested against the name of all tests, and only those tests whose names contain the filter are run. Multiple filter strings may be passed, which will run all tests matching any of the filters.

§ipc: Option<String>

Run the test suite in worker IPC mode - listening on the given local socket waiting for the test runner to connect and send test execution requests. The only stdout/stderr output will be the one emitted by the actual test runs so the test runner can capture them.

§spawn_workers: bool

If true, spawn worker processes in IPC mode and run the tests on those

Implementations§

Source§

impl Arguments

Source

pub fn from_args() -> Self

Parses the global CLI arguments given to the application.

If the parsing fails (due to incorrect CLI args), an error is shown and the application exits. If help is requested (-h or --help), a help message is shown and the application exits, too.

Source

pub fn to_args(&self) -> Vec<OsString>

Renders the arguments as a list of strings that can be passed to a subprocess

Source

pub fn unit_test_threshold(&self) -> TimeThreshold

Source

pub fn integration_test_threshold(&self) -> TimeThreshold

Trait Implementations§

Source§

impl Args for Arguments

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

impl Clone for Arguments

Source§

fn clone(&self) -> Arguments

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CommandFactory for Arguments

Source§

fn command<'b>() -> Command

Build a Command that can instantiate Self. Read more
Source§

fn command_for_update<'b>() -> Command

Build a Command that can update self. Read more
Source§

impl Debug for Arguments

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Arguments

Source§

fn default() -> Arguments

Returns the “default value” for a type. Read more
Source§

impl FromArgMatches for Arguments

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl<A: Into<OsString> + Clone> FromIterator<A> for Arguments

Source§

fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl Parser for Arguments

Source§

fn parse() -> Self

Parse from std::env::args_os(), exit on error.
Source§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
Source§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, exit on error.
Source§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
Source§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, exit on error. Read more
Source§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TryClone for T
where T: Clone,

Source§

fn try_clone(&self) -> Result<T, Error>

Clones self, possibly returning an error.
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.
Source§

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

Source§

fn vzip(self) -> V