Struct spinoso_env::InvalidError[][src]

pub struct InvalidError(_);

Error that indicates the underlying platform API returned an error.

This error is typically returned by the operating system and corresponds to EINVAL.

Examples

let err = InvalidError::new();
assert_eq!(err.message(), b"Errno::EINVAL");

let err = InvalidError::with_message("Invalid argument - setenv()");
assert_eq!(err.message(), b"Invalid argument - setenv()");

Implementations

impl InvalidError[src]

#[must_use]pub const fn new() -> Self[src]

Construct a new, default invalid error.

Examples

const ERR: InvalidError = InvalidError::new();
assert_eq!(ERR.message(), b"Errno::EINVAL");

#[must_use]pub const fn with_message(message: &'static str) -> Self[src]

Construct a new, invalid error with a message.

Examples

const ERR: InvalidError = InvalidError::with_message("Invalid argument - setenv()");
assert_eq!(ERR.message(), b"Invalid argument - setenv()");

#[must_use]pub fn message(&self) -> &[u8][src]

Retrieve the exception message associated with this invalid error.

Examples

let err = InvalidError::new();
assert_eq!(err.message(), b"Errno::EINVAL");

#[must_use]pub fn into_message(self) -> Cow<'static, [u8]>[src]

Consume this error and return the inner message.

This method allows taking ownership of this error’s message without an allocation.

Examples

let err = InvalidError::new();
assert_eq!(err.into_message(), Cow::Borrowed(b"Errno::EINVAL"));

Trait Implementations

impl Clone for InvalidError[src]

impl Debug for InvalidError[src]

impl Display for InvalidError[src]

impl Eq for InvalidError[src]

impl Error for InvalidError[src]

impl From<&'static [u8]> for InvalidError[src]

impl From<&'static str> for InvalidError[src]

impl From<InvalidError> for Error[src]

impl From<Vec<u8, Global>> for InvalidError[src]

impl Hash for InvalidError[src]

impl Ord for InvalidError[src]

impl PartialEq<InvalidError> for InvalidError[src]

impl PartialOrd<InvalidError> for InvalidError[src]

impl StructuralEq for InvalidError[src]

impl StructuralPartialEq for InvalidError[src]

Auto Trait Implementations

impl RefUnwindSafe for InvalidError

impl Send for InvalidError

impl Sync for InvalidError

impl Unpin for InvalidError

impl UnwindSafe for InvalidError

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> 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.