Lines Matching refs:State

185         State::with(|s| s.async_pending_exports_ready.insert(id, tx));  in async_pending()
196 State::with(|s| { in async_pending()
212 State::with(|s| s.future_readers.remove(&id).unwrap()) in future_take()
216 let prev = State::with(|s| s.future_readers.insert(id, f)); in future_receive()
221 State::with(|s| s.stream_readers.remove(&id).unwrap()) in stream_take()
225 let prev = State::with(|s| s.stream_readers.insert(id, f)); in stream_receive()
231 struct State { struct
252 impl State { argument
253 pub fn with<R>(f: impl FnOnce(&mut State) -> R) -> R { in with()
254 static STATE: Mutex<Option<State>> = Mutex::new(None); in with()
256 let state = state.get_or_insert_with(|| State::default()); in with()
260 pub async fn test_property(mut f: impl FnMut(&mut State) -> bool) -> bool { in test_property()
265 if State::with(&mut f) { in test_property()
283 State::test_property(|s| s.async_pending_exports_ready.contains_key(&i)).await, in run()
287 State::with(|s| { in run()
297 State::test_property(|s| s.async_pending_exports_cancelled.remove(&i)).await, in run()
306 State::with(|s| { in run()
313 State::with(|s| s.async_pending_imports_ready.insert(i)); in run()
320 State::with(|s| { in run()
330 State::test_property(|s| s.async_pending_imports_ready.remove(&i)).await, in run()
337 State::with(|s| { in run()
346 State::with(|s| { in run()
352 let reader = State::with(|s| s.future_readers.remove(&id).unwrap()); in run()
356 let _ = State::with(|s| s.future_readers.remove(&id).unwrap()); in run()
359 let writer = State::with(|s| s.future_writers.remove(&payload.future).unwrap()); in run()
363 let reader = State::with(|s| s.future_readers.remove(&payload.future).unwrap()); in run()
367 let writer = State::with(|s| s.future_writers.remove(&id).unwrap()); in run()
376 let writer = State::with(|s| s.future_writers.remove(&payload.future).unwrap()); in run()
386 State::with(|s| match result { in run()
399 State::with(|s| { in run()
433 let reader = State::with(|s| s.future_readers.remove(&id).unwrap()); in run()
442 State::with(|s| match result { in run()
453 State::with(|s| { in run()
484 State::with(|s| { in run()
492 State::test_property(|s| s.future_writers.contains_key(&id)).await, in run()
497 State::with(|s| { in run()
505 State::test_property(|s| s.future_readers.contains_key(&id)).await, in run()
511 State::test_property(|s| match s.future_writes_completed.remove(&id) { in run()
522 State::test_property(|s| match s.future_writes_completed.remove(&id) { in run()
533 State::test_property(|s| { in run()
550 State::with(|s| { in run()
559 State::with(|s| { in run()
565 let reader = State::with(|s| s.stream_readers.remove(&id).unwrap()); in run()
569 let _ = State::with(|s| s.stream_readers.remove(&id).unwrap()); in run()
572 let _ = State::with(|s| s.stream_writers.remove(&id).unwrap()); in run()
575 State::with(|s| { in run()
588 State::with(|s| { in run()
598 State::with(|s| { in run()
608 State::with(|s| { in run()
619 let mut writer = State::with(|s| s.stream_writers.remove(&payload.stream).unwrap()); in run()
621 State::with(|s| { in run()
633 State::with(|s| { in run()
679 let mut reader = State::with(|s| s.stream_readers.remove(&payload.stream).unwrap()); in run()
681 State::with(|s| { in run()
691 State::with(|s| { in run()
736 State::with(|s| { in run()
744 State::test_property(|s| s.stream_writers.contains_key(&id)).await, in run()
749 State::with(|s| { in run()
757 State::test_property(|s| s.stream_readers.contains_key(&id)).await, in run()
763 State::test_property(|s| { in run()
780 State::test_property(|s| { in run()
797 State::test_property(|s| { in run()
814 State::test_property(|s| { in run()