Realtime safe, waitfree, concurrency library
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

remove inline and rely on compiler heuristic to do cross-crate inlining

-13
-13
src/lib.rs
··· 42 42 } 43 43 44 44 /// this function never blocks. (`fetch_update` loop doesn't count) 45 - #[inline] 46 45 pub fn lock(&mut self) -> ReadGuard<'_, T> { 47 46 let shared_ref = self.shared_ref(); 48 47 ··· 58 57 unsafe impl<T: Send> Send for Reader<T> {} 59 58 60 59 impl<T> Drop for Reader<T> { 61 - #[inline] 62 60 fn drop(&mut self) { 63 61 // SAFETY: self.shared is valid and not used after this. 64 62 unsafe { Shared::drop(self.shared) }; ··· 81 79 impl<T> Deref for ReadGuard<'_, T> { 82 80 type Target = T; 83 81 84 - #[inline] 85 82 fn deref(&self) -> &Self::Target { 86 83 // SAFETY: ReadGuard was created, so the Writer knows not to write in this spot 87 84 unsafe { self.shared.get_value_ref(self.value) } ··· 93 90 E: ?Sized, 94 91 T: AsRef<E>, 95 92 { 96 - #[inline] 97 93 fn as_ref(&self) -> &E { 98 94 self.deref().as_ref() 99 95 } ··· 105 101 // unsafe impl<T: Sync> Sync for ReadGuard<'_, T> {} 106 102 107 103 impl<T> Drop for ReadGuard<'_, T> { 108 - #[inline] 109 104 fn drop(&mut self) { 110 105 // release the read lock 111 106 self.shared.release_read_lock(); ··· 152 147 } 153 148 154 149 /// get a Reader if none exists 155 - #[inline] 156 150 pub fn build_reader(&mut self) -> Option<Reader<T>> { 157 151 let shared_ref = self.shared_ref(); 158 152 // SAFETY: all is_unique_with_increase requirements are satisfied. ··· 190 184 impl<T: Clone, O> Writer<T, O> { 191 185 /// Creates a new Writer by cloning the value once to get two values 192 186 /// `T::clone()` shoulnd't give a different value, as that would make this library pretty useless 193 - #[inline] 194 187 pub fn new(value: T) -> Self { 195 188 let (shared, write_ptr) = Shared::new(value, |value_1| value_1.clone()); 196 189 Self { ··· 206 199 /// Creates a new Writer by calling `T::default()` twice to create the two values 207 200 /// 208 201 /// Default impl of T needs to give the same result every time. Not upholding this doens't lead to UB, but turns the library basically useless 209 - #[inline] 210 202 fn default() -> Self { 211 203 let (shared, write_ptr) = Shared::new(T::default(), |_| T::default()); 212 204 Self { ··· 239 231 unsafe impl<T: Sync, O> Sync for Writer<T, O> {} 240 232 241 233 impl<T, O> Drop for Writer<T, O> { 242 - #[inline] 243 234 fn drop(&mut self) { 244 235 // SAFETY: self.shared is valid and not used after this. 245 236 unsafe { Shared::drop(self.shared) }; ··· 259 250 260 251 impl<T, O> WriteGuard<'_, T, O> { 261 252 /// Makes the changes available to the reader. Equivalent to `std::mem::drop(self)` 262 - #[inline] 263 253 pub fn swap(self) {} 264 254 265 255 /// Gets the value currently being written to. 266 - #[inline] 267 256 pub fn read(&self) -> &T { 268 257 // SAFETY: Only the WriteGuard can write to the values / create mut refs to them. 269 258 // The WriteGuard holds a mut ref to the writer so this function can't be called while a writeguard exists ··· 293 282 impl<T: Absorb<O>, O: Clone> WriteGuard<'_, T, O> { 294 283 /// applies operation to the current write Value and stores it to apply to the other later. 295 284 /// If there is no reader the operation is applied to both values immediately and not stored. 296 - #[inline] 297 285 pub fn apply_op(&mut self, operation: O) { 298 286 if let Some(shared) = self.writer.shared_mut() { 299 287 shared.value_1.get_mut().absorb(operation.clone()); ··· 312 300 // unsafe impl<T: Sync, O> Sync for WriteGuard<'_, T, O> {} 313 301 314 302 impl<T, O> Drop for WriteGuard<'_, T, O> { 315 - #[inline] 316 303 fn drop(&mut self) { 317 304 self.writer.swap(); 318 305 }