[][src]Struct pstoedit::Command

pub struct Command { /* fields omitted */ }

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]

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]

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]

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]

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

Trait Implementations

impl Clone for Command[src]

impl Debug for Command[src]

impl Default for Command[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.