[−][src]Struct pstoedit::Command
Command builder for generic pstoedit interaction.
Commands are the main way to interact with pstoedit. A command is typically
constructed using arg
, args
and/or
args_slice
. It can be run using
run
, multiple times if necessary.
Examples
use pstoedit::Command; pstoedit::init()?; Command::new().arg("-gstest")?.run()?;
use pstoedit::Command; pstoedit::init()?; Command::new().args_slice(&["-f", "latex2e", "input.ps", "output.tex"])?.run()?;
Errors
Most methods can raise NulError
if a passed
string contains an internal nul byte. Only run
can raise
different errors.
Implementations
impl Command
[src]
pub fn new() -> Self
[src]
Create a command with program name and without arguments.
The program name is already set in this function and should not be set
using arg
, args
, or
args_slice
.
pub fn arg<S>(&mut self, arg: S) -> Result<&mut Self> where
S: Into<Vec<u8>>,
[src]
S: Into<Vec<u8>>,
Add a single argument.
For more information, examples, and errors, see Command
.
pub fn args<I>(&mut self, args: I) -> Result<&mut Self> where
I: IntoIterator,
I::Item: Into<Vec<u8>>,
[src]
I: IntoIterator,
I::Item: Into<Vec<u8>>,
Add multiple arguments.
Examples
use pstoedit::Command; pstoedit::init()?; Command::new().args(std::env::args().skip(1))?.run()?;
Errors
NulError
if a passed string contains an
internal nul byte. Only the arguments before this string will have been
added. Ownership of these later arguments will not be returned, consider
using arg
if necessary for more control.
pub fn args_slice<S>(&mut self, args: &[S]) -> Result<&mut Self> where
S: AsRef<str>,
[src]
S: AsRef<str>,
Add multiple arguments from slice.
Ownership of arguments is not passed for ergonomic reasons. If the
potential optimization benefits of passing ownership are desired, use
args
or arg
. This can be the case
when passing instances of String
or Vec<u8>
.
Examples
See Command
.
Errors
NulError
if a passed string contains an
internal nul byte. Only the arguments before this string will have been
added.
pub fn gs<S>(&mut self, gs: S) -> Result<&mut Self> where
S: Into<Vec<u8>>,
[src]
S: Into<Vec<u8>>,
Specify ghostscript executable.
By default pstoedit tries to automatically determine this value. The specifics of this are platform-dependent.
Examples
use pstoedit::Command; pstoedit::init()?; // Use personal ghostscript executable that is not in PATH let gs = "/home/user/projects/ghostscript/bin/gs"; Command::new().arg("-gstest")?.gs(gs)?.run()?;
pub fn run(&self) -> Result<()>
[src]
Run the command.
This can be done multiple times for the same Command
.
Examples
See Command
.
Errors
NotInitialized
ifinit
was not called successfully.PstoeditError
if pstoedit returns with a non-zero status code.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnwindSafe for Command
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,