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.


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()");


impl InvalidError[src]

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

Construct a new, default invalid error.


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.


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.


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.


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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.