[][src]Struct weld::WeldError

pub struct WeldError { /* fields omitted */ }

An error when compiling or running a Weld program.

Methods

impl WeldError[src]

pub fn new<T: Into<Vec<u8>>>(message: T, code: WeldRuntimeErrno) -> WeldError[src]

Creates a new error with a message and error code.

Examples

use weld::{WeldError, WeldRuntimeErrno};

let err = WeldError::new("A new error", WeldRuntimeErrno::Unknown);

pub fn new_unknown<T: Into<Vec<u8>>>(message: T) -> WeldError[src]

Creates a new error with a particular message and an Unknown error code.

Examples

use weld::{WeldError, WeldRuntimeErrno};

let err = WeldError::new_unknown("A new unknown error");
assert_eq!(err.code(), WeldRuntimeErrno::Unknown);

pub fn new_success() -> WeldError[src]

Creates a new error with a particular message indicating success.

The error returned by this function has a message "Success" and the error code WeldRuntimeErrno::Success.

Examples

use weld::{WeldError, WeldRuntimeErrno};

let err = WeldError::new_success();
assert_eq!(err.code(), WeldRuntimeErrno::Success);
assert_eq!(err.message().to_str().unwrap(), "Success");

pub fn code(&self) -> WeldRuntimeErrno[src]

Returns the error code of this WeldError.

Examples

use weld::{WeldError, WeldRuntimeErrno};

let err = WeldError::new("An out of memory error", WeldRuntimeErrno::OutOfMemory);
assert_eq!(err.code(), WeldRuntimeErrno::OutOfMemory);

pub fn message(&self) -> &CStr[src]

Returns the error message of this WeldError.

Examples

use weld::{WeldError, WeldRuntimeErrno};

let err = WeldError::new("Custom error", WeldRuntimeErrno::Unknown);
assert_eq!(err.message().to_str().unwrap(), "Custom error");

Trait Implementations

impl Clone for WeldError[src]

impl Debug for WeldError[src]

impl Default for WeldError[src]

Auto Trait Implementations

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.