@@ -34,6 +34,7 @@ impl fmt::Display for SerializedSignature {
34
34
}
35
35
36
36
impl Default for SerializedSignature {
37
+ #[ inline]
37
38
fn default ( ) -> SerializedSignature {
38
39
SerializedSignature {
39
40
data : [ 0u8 ; 72 ] ,
@@ -43,12 +44,14 @@ impl Default for SerializedSignature {
43
44
}
44
45
45
46
impl PartialEq for SerializedSignature {
47
+ #[ inline]
46
48
fn eq ( & self , other : & SerializedSignature ) -> bool {
47
49
* * self == * * other
48
50
}
49
51
}
50
52
51
53
impl AsRef < [ u8 ] > for SerializedSignature {
54
+ #[ inline]
52
55
fn as_ref ( & self ) -> & [ u8 ] {
53
56
& * self
54
57
}
@@ -57,6 +60,7 @@ impl AsRef<[u8]> for SerializedSignature {
57
60
impl ops:: Deref for SerializedSignature {
58
61
type Target = [ u8 ] ;
59
62
63
+ #[ inline]
60
64
fn deref ( & self ) -> & [ u8 ] {
61
65
& self . data [ ..self . len ]
62
66
}
@@ -78,45 +82,53 @@ impl<'a> IntoIterator for &'a SerializedSignature {
78
82
type IntoIter = core:: slice:: Iter < ' a , u8 > ;
79
83
type Item = & ' a u8 ;
80
84
85
+ #[ inline]
81
86
fn into_iter ( self ) -> Self :: IntoIter {
82
87
self . iter ( )
83
88
}
84
89
}
85
90
86
91
impl SerializedSignature {
87
92
/// Get a pointer to the underlying data with the specified capacity.
93
+ #[ inline]
88
94
pub ( crate ) fn get_data_mut_ptr ( & mut self ) -> * mut u8 {
89
95
self . data . as_mut_ptr ( )
90
96
}
91
97
92
98
/// Get the capacity of the underlying data buffer.
99
+ #[ inline]
93
100
pub fn capacity ( & self ) -> usize {
94
101
self . data . len ( )
95
102
}
96
103
97
104
/// Get the len of the used data.
105
+ #[ inline]
98
106
pub fn len ( & self ) -> usize {
99
107
self . len
100
108
}
101
109
102
110
/// Set the length of the object.
111
+ #[ inline]
103
112
pub ( crate ) fn set_len ( & mut self , len : usize ) {
104
113
self . len = len;
105
114
}
106
115
107
116
/// Convert the serialized signature into the Signature struct.
108
117
/// (This DER deserializes it)
118
+ #[ inline]
109
119
pub fn to_signature ( & self ) -> Result < Signature , Error > {
110
120
Signature :: from_der ( self )
111
121
}
112
122
113
123
/// Create a SerializedSignature from a Signature.
114
124
/// (this DER serializes it)
125
+ #[ inline]
115
126
pub fn from_signature ( sig : & Signature ) -> SerializedSignature {
116
127
sig. serialize_der ( )
117
128
}
118
129
119
130
/// Check if the space is zero.
131
+ #[ inline]
120
132
pub fn is_empty ( & self ) -> bool { self . len ( ) == 0 }
121
133
}
122
134
0 commit comments