cfxstore/cfxkey.rs
1// Copyright 2019-2020 Conflux Foundation. All rights reserved.
2// Conflux is free software and distributed under GNU General Public License.
3// See http://www.gnu.org/licenses/
4
5// Copyright 2015-2019 Parity Technologies (UK) Ltd.
6// This file is part of Parity Ethereum.
7
8// Parity Ethereum is free software: you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation, either version 3 of the License, or
11// (at your option) any later version.
12
13// Parity Ethereum is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17
18// You should have received a copy of the GNU General Public License
19// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
20
21//! cfxkey reexport to make documentation look pretty.
22use crate::json;
23pub use cfxkey::*;
24
25impl Into<json::H160> for Address {
26 fn into(self) -> json::H160 {
27 let a: [u8; 20] = self.into();
28 From::from(a)
29 }
30}
31
32impl From<json::H160> for Address {
33 fn from(json: json::H160) -> Self {
34 let a: [u8; 20] = json.into();
35 From::from(a)
36 }
37}
38
39impl<'a> From<&'a json::H160> for Address {
40 fn from(json: &'a json::H160) -> Self {
41 let mut a = [0u8; 20];
42 a.copy_from_slice(json);
43 From::from(a)
44 }
45}