1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Shared unit-state connection teardown fixtures.
//!
//! Unit tests and integration tests both need a teardown callback that counts
//! how many connections finalized. One definition here keeps those copies from
//! drifting apart and makes "exactly once" assertions comparable across test
//! crates.
use ;
/// Boxed future returned by unit-state lifecycle callbacks.
pub type UnitFuture = ;
/// Build a teardown callback for unit connection state that counts
/// invocations.
///
/// Each invocation increments the shared counter by one, so a test can assert
/// that teardown ran exactly once per connection.
///
/// ```rust,no_run
/// use std::sync::{
/// Arc,
/// atomic::{AtomicUsize, Ordering},
/// };
///
/// use wireframe::test_helpers::counting_teardown;
///
/// let calls = Arc::new(AtomicUsize::new(0));
/// let teardown = counting_teardown(Arc::clone(&calls));
/// futures::executor::block_on(teardown(()));
/// assert_eq!(calls.load(Ordering::SeqCst), 1);
/// ```
+ Send + Sync + 'static