[][src]Enum gpp::Error

pub enum Error {
    InvalidCommand {
        command_name: String,
    },
    TooManyParameters {
        command: &'static str,
    },
    UnexpectedCommand {
        command: &'static str,
    },
    ChildFailed {
        status: ExitStatus,
    },
    PipeFailed,
    IoError(Error),
    FromUtf8Error(FromUtf8Error),
    FileError {
        filename: String,
        line: usize,
        error: Box<Error>,
    },
}

Error enum for parsing errors.

This type implements std::fmt::Display, and so can easily be printed with println!.

Examples

let error = gpp::Error::TooManyParameters { command: "my_command" };
assert_eq!(format!("{}", error), "Too many parameters for #my_command");
let error = gpp::Error::FileError {
    filename: String::from("my_file"),
    line: 10,
    error: Box::new(gpp::Error::UnexpectedCommand {
        command: "this_command",
    }),
};
assert_eq!(format!("{}", error), "Error in my_file:10: Unexpected command #this_command");

Variants

InvalidCommand

An unknown command was encountered.

Fields of InvalidCommand

command_name: String
TooManyParameters

Too many parameters were given for a command (for example using #endif with parameters).

Fields of TooManyParameters

command: &'static str
UnexpectedCommand

There was an unexpected command; currently only generated for unexpected #endins.

Fields of UnexpectedCommand

command: &'static str
ChildFailed

The child process for an #exec exited with a nonzero status.

Fields of ChildFailed

status: ExitStatus
PipeFailed

A pipe was unable to be set up to the child.

IoError(Error)

An error with I/O occurred.

FromUtf8Error(FromUtf8Error)

An error occurred parsing a child's standard output as UTF-8.

FileError

An error occurred in another file.

Fields of FileError

filename: Stringline: usizeerror: Box<Error>

Trait Implementations

impl From<Error> for Error[src]

impl From<FromUtf8Error> for Error[src]

impl Display for Error[src]

impl Debug for Error[src]

impl Error for Error[src]

Auto Trait Implementations

impl Send for Error

impl Sync for Error

impl Unpin for Error

impl !UnwindSafe for Error

impl !RefUnwindSafe for Error

Blanket Implementations

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

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]