CargoCommandBuilder

Struct CargoCommandBuilder 

Source
pub struct CargoCommandBuilder {
Show 24 fields pub target_name: String, pub manifest_path: PathBuf, pub args: Vec<String>, pub subcommand: String, pub pid: Option<u32>, pub alternate_cmd: Option<String>, pub execution_dir: Option<PathBuf>, pub suppressed_flags: HashSet<String>, pub stdout_dispatcher: Option<Arc<EventDispatcher>>, pub stderr_dispatcher: Option<Arc<EventDispatcher>>, pub progress_dispatcher: Option<Arc<EventDispatcher>>, pub stage_dispatcher: Option<Arc<EventDispatcher>>, pub terminal_error_flag: Arc<Mutex<bool>>, pub sender: Option<Arc<Mutex<Sender<TerminalError>>>>, pub diagnostics: Arc<Mutex<Vec<CargoDiagnostic>>>, pub is_filter: bool, pub use_cache: bool, pub default_binary_is_runner: bool, pub be_silent: bool, pub detached: bool, pub time_limit: Option<u32>, pub detached_hold: Option<u32>, pub detached_delay: Option<u32>, pub cwd_wsr: bool,
}
Expand description

A builder that constructs a Cargo command for a given target.

Fields§

§target_name: String§manifest_path: PathBuf§args: Vec<String>§subcommand: String§pid: Option<u32>§alternate_cmd: Option<String>§execution_dir: Option<PathBuf>§suppressed_flags: HashSet<String>§stdout_dispatcher: Option<Arc<EventDispatcher>>§stderr_dispatcher: Option<Arc<EventDispatcher>>§progress_dispatcher: Option<Arc<EventDispatcher>>§stage_dispatcher: Option<Arc<EventDispatcher>>§terminal_error_flag: Arc<Mutex<bool>>§sender: Option<Arc<Mutex<Sender<TerminalError>>>>§diagnostics: Arc<Mutex<Vec<CargoDiagnostic>>>§is_filter: bool§use_cache: bool§default_binary_is_runner: bool§be_silent: bool§detached: bool§time_limit: Option<u32>§detached_hold: Option<u32>§detached_delay: Option<u32>§cwd_wsr: bool

Implementations§

Source§

impl CargoCommandBuilder

Source

pub fn new( target_name: &str, manifest: &PathBuf, subcommand: &str, is_filter: bool, use_cache: bool, default_binary_is_runner: bool, be_silent: bool, detached: bool, cwd_wsr: bool, ) -> Self

Creates a new, empty builder.

Source

pub fn run<F>(self: Arc<Self>, on_spawn: F) -> Result<u32>

Source

pub fn wait(self: Arc<Self>, pid: Option<u32>) -> Result<CargoProcessResult>

Source

pub fn with_target(self, target: &CargoTarget) -> Self

Configure the command based on the target kind.

Source

pub fn with_cli(self, cli: &Cli) -> Self

Configure the command using CLI options.

Source

pub fn with_required_features( self, manifest: &PathBuf, target: &CargoTarget, ) -> Self

Append required features based on the manifest, target kind, and name. This method queries your manifest helper function and, if features are found, appends “–features” and the feature list.

Source

pub fn with_extra_args(self, extra: &[String]) -> Self

Appends extra arguments to the command.

Source

pub fn build(self) -> Vec<String>

Builds the final vector of command-line arguments.

Source

pub fn is_compiler_target(&self) -> bool

Source

pub fn injected_args(&self) -> (String, Vec<String>)

Source

pub fn print_command(&self)

Source

pub fn build_command(&self) -> Command

builds a std::process::Command.

Source

pub fn capture_output(&self) -> Result<String>

Runs the command and returns everything it printed (stdout + stderr), regardless of exit status.

Trait Implementations§

Source§

impl Clone for CargoCommandBuilder

Source§

fn clone(&self) -> CargoCommandBuilder

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 Debug for CargoCommandBuilder

Source§

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

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

impl Default for CargoCommandBuilder

Source§

fn default() -> Self

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

impl Display for CargoCommandBuilder

Source§

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

Formats the value using the given formatter. Read more

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToCompactString for T
where T: Display,

Source§

impl<T> ToLine for T
where T: Display,

Source§

fn to_line(&self) -> Line<'_>

Converts the value to a Line.
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> ToSpan for T
where T: Display,

Source§

fn to_span(&self) -> Span<'_>

Converts the value to a Span.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

impl<T> ToText for T
where T: Display,

Source§

fn to_text(&self) -> Text<'_>

Converts the value to a Text.
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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,