pub struct P4Cli { /* private fields */ }Expand description
A handle to a p4 binary, either from the system or downloaded.
Resolution order:
- Check
PATHand common install directories for a workingp4. - Download from Perforce’s official filehost.
use p4cli_20251::P4Cli;
fn main() -> std::io::Result<()> {
let p4: P4Cli = P4Cli::new()?;
let output: p4cli_20251::P4Output = p4.run(&["--help"])?;
println!("exit: {}", output.exit_code());
println!("stdout: {}", output.stdout_str()?);
Ok(())
}Implementations§
Source§impl P4Cli
impl P4Cli
Sourcepub fn run<S: AsRef<OsStr>>(&self, args: &[S]) -> Result<P4Output>
pub fn run<S: AsRef<OsStr>>(&self, args: &[S]) -> Result<P4Output>
Equivalent to self.command().args(args).run().
Sourcepub fn stream<S: AsRef<OsStr>>(&self, args: &[S]) -> Result<P4Stream>
pub fn stream<S: AsRef<OsStr>>(&self, args: &[S]) -> Result<P4Stream>
Equivalent to self.command().args(args).stream().
Sourcepub fn command(&self) -> P4Command<'_>
pub fn command(&self) -> P4Command<'_>
Obtain a P4Command builder.
use p4cli_20251::P4Cli;
use std::time::Duration;
fn main() -> std::io::Result<()> {
let p4: P4Cli = P4Cli::new()?;
let output: p4cli_20251::P4Output = p4
.command()
.arg("--help")
.timeout(Duration::from_secs(10))
.run()?;
if output.success() {
println!("{}", output.stdout_str()?);
}
Ok(())
}Auto Trait Implementations§
impl Freeze for P4Cli
impl RefUnwindSafe for P4Cli
impl Send for P4Cli
impl Sync for P4Cli
impl Unpin for P4Cli
impl UnsafeUnpin for P4Cli
impl UnwindSafe for P4Cli
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