idpath 0.1.1

Hierarchical path encoding for scalable storage systems / 为可扩展存储系统设计的层次化路径编码
Documentation
use std::fmt::{self, Display, Formatter};

use hipstr::HipStr;

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Error {
  InvalidPath(HipStr<'static>),
  DecodeFailed(HipStr<'static>),
}

impl std::error::Error for Error {}

impl Display for Error {
  fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
    match self {
      Error::InvalidPath(path) => write!(f, "idpath : Invalid Path: {path}"),
      Error::DecodeFailed(path) => write!(f, "idpath : Decode Base32 Error: {path}"),
    }
  }
}

pub type Result<T> = std::result::Result<T, Error>;