Type Definition pam_client::Error[][src]

type Error = ErrorWith<NoPayload>;

Error type for PAM operations without error payload.

This variant never contains a payload.

Implementations

impl Error[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 TryFrom<PamReturnCode> for Error[src]

Wrapping of a ReturnCode in a Error without a PAM context.

This is used internally to construct Error instances when no PAM context is available. These instances won't have a message string, only a code.

The conversion only fails on ReturnCode::SUCCESS.

Examples:

use std::convert::{TryFrom};

let error = Error::try_from(ReturnCode::ABORT).unwrap();
println!("{:?}", error);
use std::convert::{TryInto};

let error: Error = ReturnCode::ABORT.try_into().unwrap();
println!("{:?}", error);
use std::convert::{TryInto};

let error: Error = ReturnCode::SUCCESS.try_into().unwrap(); // should panic

type Error = ()

The type returned in the event of a conversion error.