@@ -11,11 +11,6 @@ pub mod params;
11
11
#[ cfg( feature = "bitcoinconsensus" ) ]
12
12
pub mod validation;
13
13
14
- use core:: fmt;
15
-
16
- use hex:: { HexToBytesError , HexToBytesIter } ;
17
- use internals:: write_err;
18
-
19
14
pub use self :: encode:: {
20
15
deserialize, deserialize_partial, serialize, Decodable , Encodable , ReadExt , WriteExt ,
21
16
} ;
@@ -25,51 +20,5 @@ pub use self::validation::{
25
20
verify_script, verify_script_with_flags, verify_transaction, verify_transaction_with_flags,
26
21
} ;
27
22
28
- /// Deserialize any decodable type from a hex string.
29
- pub fn deserialize_hex < T : Decodable > ( hex : & str ) -> Result < T , DecodeHexError > {
30
- let mut decoder = HexToBytesIter :: new ( hex) ?;
31
- let rv = Decodable :: consensus_decode_from_finite_reader ( & mut decoder) ?;
32
- Ok ( rv)
33
- }
34
-
35
- /// Hex decoding error.
36
- #[ derive( Debug ) ]
37
- pub enum DecodeHexError {
38
- /// Hex decoding error.
39
- Decode ( HexToBytesError ) ,
40
- /// Consensus deserialization error.
41
- Deser ( encode:: Error ) ,
42
- }
43
-
44
- impl fmt:: Display for DecodeHexError {
45
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
46
- use DecodeHexError :: * ;
47
-
48
- match * self {
49
- Decode ( ref e) => write_err ! ( f, "hex decoding erorr" ; e) ,
50
- Deser ( ref e) => write_err ! ( f, "consensus deserialization error" ; e) ,
51
- }
52
- }
53
- }
54
-
55
- #[ cfg( feature = "std" ) ]
56
- impl std:: error:: Error for DecodeHexError {
57
- fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
58
- use DecodeHexError :: * ;
59
-
60
- match * self {
61
- Decode ( _) | Deser ( _) => None ,
62
- }
63
- }
64
- }
65
-
66
- impl From < HexToBytesError > for DecodeHexError {
67
- fn from ( e : HexToBytesError ) -> Self { Self :: Decode ( e) }
68
- }
69
-
70
- impl From < encode:: Error > for DecodeHexError {
71
- fn from ( e : encode:: Error ) -> Self { Self :: Deser ( e) }
72
- }
73
-
74
23
#[ cfg( feature = "serde" ) ]
75
24
pub mod serde;
0 commit comments