#[derive(Debug)]
pub enum UserAndGroupChoiceError
{
#[allow(missing_docs)]
EtcPasswdParse(EtcPasswdParseError),
#[allow(missing_docs)]
EtcGroupParse(EtcGroupParseError),
UserNameNotPresentInEtcPasswd,
UserIdentifierNotPresentInEtcPasswd,
GroupIdentifierNotPresentInEtcGroup,
GroupNameNotPresentInEtcGroup,
#[allow(missing_docs)]
DuplicateGroupIdentifier(GroupIdentifier),
#[allow(missing_docs)]
TooManySupplementaryGroups(usize),
}
impl Display for UserAndGroupChoiceError
{
#[inline(always)]
fn fmt(&self, f: &mut Formatter) -> fmt::Result
{
Debug::fmt(self, f)
}
}
impl error::Error for UserAndGroupChoiceError
{
#[inline(always)]
fn source(&self) -> Option<&(dyn error::Error + 'static)>
{
use self::UserAndGroupChoiceError::*;
match self
{
&EtcPasswdParse(ref cause) => Some(cause),
&EtcGroupParse(ref cause) => Some(cause),
&UserNameNotPresentInEtcPasswd => None,
&UserIdentifierNotPresentInEtcPasswd => None,
&GroupIdentifierNotPresentInEtcGroup => None,
&GroupNameNotPresentInEtcGroup => None,
&DuplicateGroupIdentifier(..) => None,
&TooManySupplementaryGroups(..) => None,
}
}
}
impl From<EtcPasswdParseError> for UserAndGroupChoiceError
{
#[inline(always)]
fn from(cause: EtcPasswdParseError) -> Self
{
UserAndGroupChoiceError::EtcPasswdParse(cause)
}
}
impl From<EtcGroupParseError> for UserAndGroupChoiceError
{
#[inline(always)]
fn from(cause: EtcGroupParseError) -> Self
{
UserAndGroupChoiceError::EtcGroupParse(cause)
}
}