runx-sdk
runx_sdk::command
Structs §
CommandPlan §
pub struct runx_sdk::command::CommandPlan { /* ... */ }
Implementations §
impl CommandPlan
new
fn new(command: &[String], args: &[String]) -> RunxResult<Self>Build a plan from a command vector (program + leading args) plus extra args.
Examples
use runx_sdk::command::CommandPlan;
use runx_sdk::error::RunxResult;
# fn main() -> RunxResult<()> {
let plan = CommandPlan::new(&<code title="unresolved intra-doc link">"runx".into()</code>, &<code title="unresolved intra-doc link">"skill".into(), "echo".into()</code>)?;
assert_eq!(plan.program, "runx");
assert_eq!(plan.args, <code title="unresolved intra-doc link">"skill", "echo"</code>);
assert_eq!(plan.argv(), <code title="unresolved intra-doc link">"runx", "skill", "echo"</code>);
// An empty command is rejected.
assert!(CommandPlan::new(&[], &[]).is_err());
# Ok(())
# }use runx_sdk::command::CommandPlan;
use runx_sdk::error::RunxResult;
let plan = CommandPlan::new(&["runx".into()], &["skill".into(), "echo".into()])?;
assert_eq!(plan.program, "runx");
assert_eq!(plan.args, ["skill", "echo"]);
assert_eq!(plan.argv(), ["runx", "skill", "echo"]);
// An empty command is rejected.
assert!(CommandPlan::new(&[], &[]).is_err());
use runx_sdk::command::CommandPlan;
use runx_sdk::error::RunxResult;
fn main() -> RunxResult<()> {
let plan = CommandPlan::new(&["runx".into()], &["skill".into(), "echo".into()])?;
assert_eq!(plan.program, "runx");
assert_eq!(plan.args, ["skill", "echo"]);
assert_eq!(plan.argv(), ["runx", "skill", "echo"]);
// An empty command is rejected.
assert!(CommandPlan::new(&[], &[]).is_err());
Ok(())
}
with_cwd
fn with_cwd(self: Self, cwd: Option<PathBuf>) -> Selfwith_env
fn with_env(self: Self, env: BTreeMap<String, String>) -> Selfwith_stdin
fn with_stdin(self: Self, stdin: Option<String>) -> Selfargv
fn argv(self: &Self) -> Vec<String>Trait Implementations §
impl Borrow for CommandPlan
borrow
fn borrow(self: &Self) -> &Timpl BorrowMut for CommandPlan
borrow_mut
fn borrow_mut(self: &mut Self) -> &mut Timpl CloneToUninit for CommandPlan
clone_to_uninit
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)impl Into for CommandPlan
into
fn into(self: Self) -> UCalls U::from(self).
That is, this conversion is whatever the implementation of
chooses to do.From<T> for U
impl From for CommandPlan
from
fn from(t: T) -> TReturns the argument unchanged.
impl TryInto for CommandPlan
Error
try_into
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>impl TryFrom for CommandPlan
Error
try_from
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>impl Any for CommandPlan
type_id
fn type_id(self: &Self) -> TypeIdimpl ToOwned for CommandPlan
Owned
to_owned
fn to_owned(self: &Self) -> Tclone_into
fn clone_into(self: &Self, target: &mut T)impl Same for CommandPlan
Output
impl Clone for CommandPlan
clone
fn clone(self: &Self) -> CommandPlanimpl Debug for CommandPlan
fmt
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Resultimpl PartialEq for CommandPlan
eq
fn eq(self: &Self, other: &CommandPlan) -> boolimpl Send for CommandPlan
impl Sync for CommandPlan
impl Freeze for CommandPlan
impl UnsafeUnpin for CommandPlan
impl Unpin for CommandPlan
impl UnwindSafe for CommandPlan
impl RefUnwindSafe for CommandPlan
impl StructuralPartialEq for CommandPlan
impl Eq for CommandPlan
CommandOutput §
pub struct runx_sdk::command::CommandOutput { /* ... */ }
Trait Implementations §
impl Borrow for CommandOutput
borrow
fn borrow(self: &Self) -> &Timpl BorrowMut for CommandOutput
borrow_mut
fn borrow_mut(self: &mut Self) -> &mut Timpl CloneToUninit for CommandOutput
clone_to_uninit
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)impl Into for CommandOutput
into
fn into(self: Self) -> UCalls U::from(self).
That is, this conversion is whatever the implementation of
chooses to do.From<T> for U
impl From for CommandOutput
from
fn from(t: T) -> TReturns the argument unchanged.