Mercurial > hg
comparison rust/hg-core/src/revlog/node.rs @ 46595:98a455a62699
rust: Make `DirstateParents`’s fields typed `Node`s
Instead of plain byte arrays.
Differential Revision: https://phab.mercurial-scm.org/D10006
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 17 Feb 2021 12:24:53 +0100 |
parents | 43d63979a75e |
children | b1f2c2b336ec |
comparison
equal
deleted
inserted
replaced
46594:f88e8ae0aa8f | 46595:98a455a62699 |
---|---|
80 | 80 |
81 #[inline] | 81 #[inline] |
82 fn try_from(bytes: &'_ [u8]) -> Result<Self, Self::Error> { | 82 fn try_from(bytes: &'_ [u8]) -> Result<Self, Self::Error> { |
83 let data = bytes.try_into()?; | 83 let data = bytes.try_into()?; |
84 Ok(Self { data }) | 84 Ok(Self { data }) |
85 } | |
86 } | |
87 | |
88 impl From<&'_ NodeData> for Node { | |
89 #[inline] | |
90 fn from(data: &'_ NodeData) -> Self { | |
91 Self { data: *data } | |
85 } | 92 } |
86 } | 93 } |
87 | 94 |
88 impl fmt::LowerHex for Node { | 95 impl fmt::LowerHex for Node { |
89 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | 96 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |