@@ -65,6 +65,7 @@ use crate::write_err;
65
65
/// let (_hrp, _witness_version, _witness_program) = segwit::decode(address).expect("failed to decode address");
66
66
/// ```
67
67
#[ cfg( feature = "alloc" ) ]
68
+ #[ inline]
68
69
pub fn decode ( s : & str ) -> Result < ( Hrp , Fe32 , Vec < u8 > ) , SegwitHrpstringError > {
69
70
let segwit = SegwitHrpstring :: new ( s) ?;
70
71
Ok ( ( segwit. hrp ( ) , segwit. witness_version ( ) , segwit. byte_iter ( ) . collect :: < Vec < u8 > > ( ) ) )
@@ -85,6 +86,7 @@ pub fn decode(s: &str) -> Result<(Hrp, Fe32, Vec<u8>), SegwitHrpstringError> {
85
86
/// [BIP-173]: <https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki>
86
87
/// [BIP-350]: <https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki>
87
88
#[ cfg( feature = "alloc" ) ]
89
+ #[ inline]
88
90
pub fn encode (
89
91
hrp : & Hrp ,
90
92
witness_version : Fe32 ,
@@ -100,12 +102,14 @@ pub fn encode(
100
102
101
103
/// Encodes a segwit version 0 address.
102
104
#[ cfg( feature = "alloc" ) ]
105
+ #[ inline]
103
106
pub fn encode_v0 ( hrp : & Hrp , witness_program : & [ u8 ] ) -> Result < String , EncodeError > {
104
107
encode ( hrp, VERSION_0 , witness_program)
105
108
}
106
109
107
110
/// Encodes a segwit version 1 address.
108
111
#[ cfg( feature = "alloc" ) ]
112
+ #[ inline]
109
113
pub fn encode_v1 ( hrp : & Hrp , witness_program : & [ u8 ] ) -> Result < String , EncodeError > {
110
114
encode ( hrp, VERSION_1 , witness_program)
111
115
}
@@ -114,6 +118,7 @@ pub fn encode_v1(hrp: &Hrp, witness_program: &[u8]) -> Result<String, EncodeErro
114
118
///
115
119
/// Does not check the validity of the witness version and witness program lengths (see
116
120
/// the [`crate::primitives::segwit`] module for validation functions).
121
+ #[ inline]
117
122
pub fn encode_to_fmt_unchecked < W : fmt:: Write > (
118
123
fmt : & mut W ,
119
124
hrp : & Hrp ,
@@ -142,6 +147,7 @@ pub fn encode_to_fmt_unchecked<W: fmt::Write>(
142
147
///
143
148
/// Does not check the validity of the witness version and witness program lengths (see
144
149
/// the [`crate::primitives::segwit`] module for validation functions).
150
+ #[ inline]
145
151
pub fn encode_to_fmt_unchecked_uppercase < W : fmt:: Write > (
146
152
fmt : & mut W ,
147
153
hrp : & Hrp ,
0 commit comments