@@ -89,45 +89,48 @@ impl<H, T> HeaderVec<H, T> {
89
89
/// Get the length of the vector from a mutable reference. When one has a `&mut
90
90
/// HeaderVec`, this is the method is always exact and can be slightly faster than the non
91
91
/// mutable `len()`.
92
- #[ cfg( feature = "atomic_append" ) ]
93
- #[ inline( always) ]
94
- pub fn len_exact ( & mut self ) -> usize {
95
- * self . header_mut ( ) . len . get_mut ( )
96
- }
97
- #[ cfg( not( feature = "atomic_append" ) ) ]
98
92
#[ inline( always) ]
99
93
pub fn len_exact ( & mut self ) -> usize {
100
- self . header_mut ( ) . len
94
+ #[ cfg( feature = "atomic_append" ) ]
95
+ {
96
+ * self . header_mut ( ) . len . get_mut ( )
97
+ }
98
+ #[ cfg( not( feature = "atomic_append" ) ) ]
99
+ {
100
+ self . header_mut ( ) . len
101
+ }
101
102
}
102
103
103
104
/// This gives the length of the `HeaderVec`. This is the non synchronized variant may
104
105
/// produce racy results in case another thread atomically appended to
105
106
/// `&self`. Nevertheless it is always safe to use.
106
- #[ cfg( feature = "atomic_append" ) ]
107
107
#[ inline( always) ]
108
108
pub fn len ( & self ) -> usize {
109
- self . len_atomic_relaxed ( )
110
- }
111
- #[ cfg( not( feature = "atomic_append" ) ) ]
112
- #[ inline( always) ]
113
- pub fn len ( & self ) -> usize {
114
- self . header ( ) . len
109
+ #[ cfg( feature = "atomic_append" ) ]
110
+ {
111
+ self . len_atomic_relaxed ( )
112
+ }
113
+ #[ cfg( not( feature = "atomic_append" ) ) ]
114
+ {
115
+ self . header ( ) . len
116
+ }
115
117
}
116
118
117
119
/// This gives the length of the `HeaderVec`. With `atomic_append` enabled this gives a
118
120
/// exact result *after* another thread atomically appended to this `HeaderVec`. It still
119
121
/// requires synchronization because the length may become invalidated when another thread
120
122
/// atomically appends data to this `HeaderVec` while we still work with the result of
121
123
/// this method.
122
- #[ cfg( not( feature = "atomic_append" ) ) ]
123
- #[ inline( always) ]
124
- pub fn len_strict ( & self ) -> usize {
125
- self . header ( ) . len
126
- }
127
- #[ cfg( feature = "atomic_append" ) ]
128
124
#[ inline( always) ]
129
125
pub fn len_strict ( & self ) -> usize {
130
- self . len_atomic_acquire ( )
126
+ #[ cfg( feature = "atomic_append" ) ]
127
+ {
128
+ self . len_atomic_acquire ( )
129
+ }
130
+ #[ cfg( not( feature = "atomic_append" ) ) ]
131
+ {
132
+ self . header ( ) . len
133
+ }
131
134
}
132
135
133
136
/// Check whenever a `HeaderVec` is empty. This uses a `&mut self` reference and is
0 commit comments