@@ -65,6 +65,7 @@ use crate::write_err;
6565/// let (_hrp, _witness_version, _witness_program) = segwit::decode(address).expect("failed to decode address");
6666/// ```
6767#[ cfg( feature = "alloc" ) ]
68+ #[ inline]
6869pub fn decode ( s : & str ) -> Result < ( Hrp , Fe32 , Vec < u8 > ) , SegwitHrpstringError > {
6970 let segwit = SegwitHrpstring :: new ( s) ?;
7071 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> {
8586/// [BIP-173]: <https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki>
8687/// [BIP-350]: <https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki>
8788#[ cfg( feature = "alloc" ) ]
89+ #[ inline]
8890pub fn encode (
8991 hrp : & Hrp ,
9092 witness_version : Fe32 ,
@@ -100,12 +102,14 @@ pub fn encode(
100102
101103/// Encodes a segwit version 0 address.
102104#[ cfg( feature = "alloc" ) ]
105+ #[ inline]
103106pub fn encode_v0 ( hrp : & Hrp , witness_program : & [ u8 ] ) -> Result < String , EncodeError > {
104107 encode ( hrp, VERSION_0 , witness_program)
105108}
106109
107110/// Encodes a segwit version 1 address.
108111#[ cfg( feature = "alloc" ) ]
112+ #[ inline]
109113pub fn encode_v1 ( hrp : & Hrp , witness_program : & [ u8 ] ) -> Result < String , EncodeError > {
110114 encode ( hrp, VERSION_1 , witness_program)
111115}
@@ -114,6 +118,7 @@ pub fn encode_v1(hrp: &Hrp, witness_program: &[u8]) -> Result<String, EncodeErro
114118///
115119/// Does not check the validity of the witness version and witness program lengths (see
116120/// the [`crate::primitives::segwit`] module for validation functions).
121+ #[ inline]
117122pub fn encode_to_fmt_unchecked < W : fmt:: Write > (
118123 fmt : & mut W ,
119124 hrp : & Hrp ,
@@ -142,6 +147,7 @@ pub fn encode_to_fmt_unchecked<W: fmt::Write>(
142147///
143148/// Does not check the validity of the witness version and witness program lengths (see
144149/// the [`crate::primitives::segwit`] module for validation functions).
150+ #[ inline]
145151pub fn encode_to_fmt_unchecked_uppercase < W : fmt:: Write > (
146152 fmt : & mut W ,
147153 hrp : & Hrp ,
0 commit comments