rust/hg-core/src/lib.rs
changeset 50857 f50e71fdfcb4
parent 50532 a8531bd9210b
child 50863 c112cc9effdc
equal deleted inserted replaced
50856:2b4bcdc948e7 50857:f50e71fdfcb4
    64 pub enum DirstateMapError {
    64 pub enum DirstateMapError {
    65     PathNotFound(HgPathBuf),
    65     PathNotFound(HgPathBuf),
    66     InvalidPath(HgPathError),
    66     InvalidPath(HgPathError),
    67 }
    67 }
    68 
    68 
       
    69 impl From<HgPathError> for DirstateMapError {
       
    70     fn from(error: HgPathError) -> Self {
       
    71         Self::InvalidPath(error)
       
    72     }
       
    73 }
       
    74 
    69 impl fmt::Display for DirstateMapError {
    75 impl fmt::Display for DirstateMapError {
    70     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    76     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    71         match self {
    77         match self {
    72             DirstateMapError::PathNotFound(_) => {
    78             DirstateMapError::PathNotFound(_) => {
    73                 f.write_str("expected a value, found none")
    79                 f.write_str("expected a value, found none")
    79 
    85 
    80 #[derive(Debug, derive_more::From)]
    86 #[derive(Debug, derive_more::From)]
    81 pub enum DirstateError {
    87 pub enum DirstateError {
    82     Map(DirstateMapError),
    88     Map(DirstateMapError),
    83     Common(errors::HgError),
    89     Common(errors::HgError),
       
    90 }
       
    91 
       
    92 impl From<HgPathError> for DirstateError {
       
    93     fn from(error: HgPathError) -> Self {
       
    94         Self::Map(DirstateMapError::InvalidPath(error))
       
    95     }
    84 }
    96 }
    85 
    97 
    86 impl fmt::Display for DirstateError {
    98 impl fmt::Display for DirstateError {
    87     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    99     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    88         match self {
   100         match self {