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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
use ;
use crateOutputSink;
use Encoding;
/// A rewritable unit that represents the moment the rewriter is about to abandon
/// processing through a graceful bail-out.
///
/// Bail-out handlers registered via [`Settings::append_bail_out_handler()`] receive a
/// `&mut BailOut` and can emit final bytes into the output sink via [`append()`]. This
/// is the only opportunity for content other handlers have buffered (e.g. text withheld
/// pending a future chunk) to land in the response when the rewriter aborts.
///
/// Bytes appended via this unit are written *before* the rewriter's own raw flush of
/// remaining unparsed input. The resulting sink order is:
///
/// 1. Transformed bytes the rewriter already emitted normally.
/// 2. Bytes appended by bail-out handlers, in registration order.
/// 3. The rewriter's raw flush of the chunk's unparsed suffix.
///
/// [`Settings::append_bail_out_handler()`]:
/// crate::Settings::append_bail_out_handler
/// [`append()`]: Self::append