Struct pam_client::ErrorWith
source · [−]pub struct ErrorWith<T> { /* private fields */ }
Expand description
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
sourceimpl<T> ErrorWith<T>
impl<T> ErrorWith<T>
sourcepub fn take_payload(&mut self) -> Option<T>
pub fn take_payload(&mut self) -> Option<T>
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
.
sourcepub fn map<U>(self, func: impl FnOnce(T) -> U) -> ErrorWith<U>
pub fn map<U>(self, func: impl FnOnce(T) -> U) -> ErrorWith<U>
Maps the error payload to another type
sourcepub fn into_without_payload(self) -> Error
pub fn into_without_payload(self) -> Error
Removes the payload and converts to Error
sourceimpl ErrorWith<NoPayload>
impl ErrorWith<NoPayload>
sourcepub fn into_with_payload<T>(self, payload: T) -> ErrorWith<T>
pub fn into_with_payload<T>(self, payload: T) -> ErrorWith<T>
Adds the payload to the error message and returns a corresponding
ErrorWith<T>
instance.
sourcepub fn into<T>(self) -> ErrorWith<T>
pub fn into<T>(self) -> ErrorWith<T>
Converts the error message into a ErrorWith<T>
instance without
a payload.
Trait Implementations
sourceimpl<T> Error for ErrorWith<T>
impl<T> Error for ErrorWith<T>
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourceimpl<T: Send + Sync + Debug + 'static> From<ErrorWith<T>> for Error
impl<T: Send + Sync + Debug + 'static> From<ErrorWith<T>> for Error
Automatic wrapping in std::io::Error
(if payload type is compatible).
fn main() -> std::result::Result<(), std::io::Error> {
some_succeeding_pam_function()?;
Ok(())
}
fn main() -> std::result::Result<(), std::io::Error> {
some_failing_pam_function()?;
Ok(())
}
impl<T> Eq for ErrorWith<T> where
T: Eq,
Auto Trait Implementations
impl<T> RefUnwindSafe for ErrorWith<T> where
T: RefUnwindSafe,
impl<T> Send for ErrorWith<T> where
T: Send,
impl<T> Sync for ErrorWith<T> where
T: Sync,
impl<T> Unpin for ErrorWith<T> where
T: Unpin,
impl<T> UnwindSafe for ErrorWith<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more