Struct pam_client::ErrorWith[][src]

#[must_use]pub struct ErrorWith<T> { /* fields omitted */ }

Base error type for PAM operations (possibly with a payload)

Errors originate from the PAM library, PAM modules or helper structs in this crate. Currently no custom instances are supported.

Implementations

impl<T> ErrorWith<T>[src]

pub fn with_payload(
    handle: &mut PamHandle,
    code: ReturnCode,
    payload: Option<T>
) -> ErrorWith<T>
[src]

Creates a new Error that takes a payload.

Functions that consume a struct can use the payload to transfer back ownership in error cases.

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

The error code.

pub fn message(&self) -> Option<&str>[src]

Text representation of the error code, if available.

pub const fn payload(&self) -> Option<&T>[src]

Returns a reference to an optional payload.

pub fn take_payload(&mut self) -> Option<T>[src]

Takes the payload out of the error message.

If a payload exists in this error, it will be moved into the returned Option. All further calls to payload() and take_payload() will return None.

pub fn drop_payload(self) -> Error[src]

Drops any payload off the error message, if one exists.

pub fn map<U>(self, func: impl FnOnce(T) -> U) -> ErrorWith<U>[src]

impl ErrorWith<NoPayload>[src]

pub fn new(handle: &mut PamHandle, code: ReturnCode) -> Error[src]

Creates a new Error.

pub fn into_with_payload<T>(self, payload: T) -> ErrorWith<T>[src]

Adds the payload to the error message and returns a corresponding ErrorWith<T> instance.

pub fn into<T>(self) -> ErrorWith<T>[src]

Converts the error message into a ErrorWith<T> instance without a payload.

Trait Implementations

impl<T: Clone> Clone for ErrorWith<T>[src]

impl<T> Debug for ErrorWith<T>[src]

impl<T> Display for ErrorWith<T>[src]

impl<T> Eq for ErrorWith<T> where
    T: Eq
[src]

impl<T> Error for ErrorWith<T>[src]

impl<T> Hash for ErrorWith<T> where
    T: Hash
[src]

impl<T> PartialEq<ErrorWith<T>> for ErrorWith<T> where
    T: PartialEq
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for ErrorWith<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for ErrorWith<T> where
    T: Send
[src]

impl<T> Sync for ErrorWith<T> where
    T: Sync
[src]

impl<T> Unpin for ErrorWith<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for ErrorWith<T> where
    T: UnwindSafe
[src]

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.