use std::error::Error as StdError;
use std::fmt;
use super::RpcError;
#[derive(Debug)]
pub enum MountError {
Rpc(RpcError),
Denied(nfs3_types::mount::mountstat3),
}
impl fmt::Display for MountError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Rpc(e) => e.fmt(f),
Self::Denied(e) => e.fmt(f),
}
}
}
impl StdError for MountError {
fn source(&self) -> Option<&(dyn StdError + 'static)> {
match self {
Self::Rpc(e) => Some(e),
Self::Denied(_) => None,
}
}
}
impl From<RpcError> for MountError {
fn from(e: RpcError) -> Self {
Self::Rpc(e)
}
}
impl MountError {
#[must_use]
pub const fn is_connection_reusable(&self) -> bool {
match self {
Self::Rpc(e) => e.is_connection_reusable(),
Self::Denied(_) => true,
}
}
}