#![cfg(feature = "macros")]
#[cfg(any(
feature = "json",
feature = "form",
feature = "multipart",
feature = "protobuf",
feature = "compression"
))]
#[path = "support/counting.rs"]
mod counting;
#[cfg(any(
feature = "json",
feature = "form",
feature = "multipart",
feature = "protobuf",
feature = "compression"
))]
mod harness {
#[cfg(feature = "compression")]
use kynos::http::header;
use kynos::{
http::{Request, StatusCode},
router::service::Service,
};
use crate::counting;
#[cfg(any(
feature = "json",
feature = "form",
feature = "multipart",
feature = "protobuf"
))]
pub(crate) type Measured = (&'static str, fn() -> Request, StatusCode, usize);
#[cfg(any(
feature = "json",
feature = "form",
feature = "multipart",
feature = "protobuf"
))]
pub(crate) struct Table {
pub(crate) bodyless_floor: Measured,
pub(crate) transport_floor: Measured,
pub(crate) responding_floor: Measured,
pub(crate) decoding: Measured,
pub(crate) encoding: Measured,
}
#[cfg(any(
feature = "json",
feature = "form",
feature = "multipart",
feature = "protobuf"
))]
impl Table {
fn rows(&self) -> [Measured; 5] {
[
self.bodyless_floor,
self.transport_floor,
self.responding_floor,
self.decoding,
self.encoding,
]
}
}
#[cfg(any(
feature = "json",
feature = "form",
feature = "multipart",
feature = "protobuf"
))]
fn counted<C>(service: &Service<C>, request: Request, expected: StatusCode) -> usize {
let (allocations, response) = counting::counted(service, request, expected);
drop(response);
allocations
}
#[cfg(feature = "compression")]
pub(crate) fn counted_carrying<C>(
service: &Service<C>,
request: Request,
expected: StatusCode,
coding: Option<&str>,
) -> usize {
let (allocations, response) = counting::counted(service, request, expected);
let carried = response
.headers()
.get(header::CONTENT_ENCODING)
.map(|coding| coding.to_str().expect("a coding spelled in ASCII"));
assert_eq!(
carried, coding,
"the response carried {carried:?} where this measurement is of \
{coding:?}; a coding negotiated down, or declined, is a count of \
an encoder that did not run"
);
drop(response);
allocations
}
#[cfg(any(
feature = "json",
feature = "form",
feature = "multipart",
feature = "protobuf"
))]
pub(crate) fn record<C>(service: &Service<C>, table: &Table) {
let mut over = Vec::new();
for (operation, build, expected, ceiling) in table.rows() {
let counted = counted(service, build(), expected);
if counted > ceiling {
over.push(format!(
"{operation} allocated {counted}, recorded {ceiling}"
));
}
}
assert!(
over.is_empty(),
"{over:?}; the ceiling is `RECORDED` in this file, which is where \
this number lives — the register row that sanctions it is filed by \
#121 under docs/nfr.md#extraction and is not there yet, so until \
then raising one is a change to this table alone, and lowering one \
is what a cheaper codec looks like"
);
}
#[cfg(any(
feature = "json",
feature = "form",
feature = "multipart",
feature = "protobuf"
))]
pub(crate) fn replay<C>(service: &Service<C>, table: &Table, replays: usize) {
for (operation, build, expected, _) in table.rows() {
let first = counted(service, build(), expected);
let mut moved = Vec::new();
for index in 0..replays {
let counted = counted(service, build(), expected);
if counted != first {
moved.push((index, counted));
}
}
assert!(
moved.is_empty(),
"{operation} allocated {first} times on one request and \
differently on {} of the next {replays}, starting at {:?}; a \
count that moves between identical requests is state \
accumulating in the codec",
moved.len(),
moved.first()
);
}
}
#[cfg(any(
feature = "json",
feature = "form",
feature = "multipart",
feature = "protobuf"
))]
pub(crate) fn decoding_costs_more_than_the_read<C>(
service: &Service<C>,
table: &Table,
) -> (usize, usize, usize) {
let (bodyless_operation, bodyless_request, bodyless_status, _) = table.bodyless_floor;
let (transport_operation, transport_request, transport_status, _) = table.transport_floor;
let (decoding_operation, decoding_request, decoding_status, _) = table.decoding;
let bodyless = counted(service, bodyless_request(), bodyless_status);
let transport = counted(service, transport_request(), transport_status);
let decoding = counted(service, decoding_request(), decoding_status);
assert!(
decoding > bodyless,
"{decoding_operation} allocated {decoding}, where the bodyless \
operation beside it ({bodyless_operation}) allocated {bodyless}; \
an operation that decodes a body should cost more than one that \
reads none"
);
assert!(
decoding >= transport,
"{decoding_operation} allocated {decoding}, where reading the same \
octets undecoded ({transport_operation}) allocated {transport}; a \
codec cheaper than the transport under it is a codec that did not \
run"
);
(bodyless, transport, decoding)
}
#[cfg(any(
feature = "json",
feature = "form",
feature = "multipart",
feature = "protobuf"
))]
pub(crate) fn writing_costs_more_than_the_status<C>(service: &Service<C>, table: &Table) {
let (floor_operation, floor_request, floor_status, _) = table.responding_floor;
let (encoding_operation, encoding_request, encoding_status, _) = table.encoding;
let floor = counted(service, floor_request(), floor_status);
let encoding = counted(service, encoding_request(), encoding_status);
assert!(
encoding > floor,
"{encoding_operation} allocated {encoding}, where the bodyless \
response beside it ({floor_operation}) allocated {floor}; an \
operation that writes a body should cost more than one that writes \
none"
);
}
}
#[cfg(feature = "json")]
mod json {
use kynos::{
extract::{body::binary::Binary, media::OctetStream},
http::{Method, Request, StatusCode},
prelude::*,
router::service::Service,
};
use crate::{
counting::request,
harness::{self, Table},
};
#[derive(Schema, serde::Deserialize, serde::Serialize)]
struct Reading {
id: u64,
value: u64,
}
const BODY: &[u8] = br#"{"id":7,"value":11}"#;
#[kynos::post("/floor")]
async fn floor() -> NoContent {
NoContent
}
#[kynos::post("/floor/bytes")]
async fn floor_bytes(body: Binary<OctetStream>) -> NoContent {
drop(body.into_inner());
NoContent
}
#[kynos::get("/floor/out")]
async fn floor_out() -> NoContent {
NoContent
}
#[kynos::post("/json")]
async fn decode(Json(reading): Json<Reading>) -> NoContent {
let _ = reading;
NoContent
}
#[kynos::get("/json/out")]
async fn encode() -> Json<Reading> {
Json(Reading { id: 7, value: 11 })
}
fn service() -> Service<()> {
Router::<()>::new()
.mount(kynos::routes![
floor,
floor_bytes,
floor_out,
decode,
encode
])
.build(())
.expect("a describable router")
}
fn floor_request() -> Request {
request(Method::POST, "/floor", None, b"")
}
fn transport_request() -> Request {
request(
Method::POST,
"/floor/bytes",
Some("application/octet-stream"),
BODY,
)
}
fn responding_floor_request() -> Request {
request(Method::GET, "/floor/out", None, b"")
}
fn decode_request() -> Request {
request(Method::POST, "/json", Some("application/json"), BODY)
}
fn encode_request() -> Request {
request(Method::GET, "/json/out", None, b"")
}
const RECORDED: Table = Table {
bodyless_floor: ("POST /floor", floor_request, StatusCode::NO_CONTENT, 7),
transport_floor: (
"POST /floor/bytes",
transport_request,
StatusCode::NO_CONTENT,
8,
),
responding_floor: (
"GET /floor/out",
responding_floor_request,
StatusCode::NO_CONTENT,
7,
),
decoding: ("POST /json", decode_request, StatusCode::NO_CONTENT, 8),
encoding: ("GET /json/out", encode_request, StatusCode::OK, 12),
};
#[test]
fn the_operations_cost_what_is_recorded() {
harness::record(&service(), &RECORDED);
}
#[test]
fn decoding_a_body_costs_more_than_reading_the_same_octets() {
harness::decoding_costs_more_than_the_read(&service(), &RECORDED);
}
#[test]
fn writing_a_body_costs_more_than_the_status_alone() {
harness::writing_costs_more_than_the_status(&service(), &RECORDED);
}
#[test]
fn a_replayed_request_costs_what_the_first_one_did() {
harness::replay(&service(), &RECORDED, 1_000);
}
}
#[cfg(feature = "form")]
mod form {
use kynos::{
extract::{
body::{binary::Binary, form::Form},
media::OctetStream,
},
http::{Method, Request, StatusCode},
prelude::*,
router::service::Service,
};
use crate::{
counting::request,
harness::{self, Table},
};
#[derive(Schema, serde::Deserialize, serde::Serialize)]
struct Reading {
id: u64,
value: u64,
}
const BODY: &[u8] = b"id=7&value=11";
#[kynos::post("/floor")]
async fn floor() -> NoContent {
NoContent
}
#[kynos::post("/floor/bytes")]
async fn floor_bytes(body: Binary<OctetStream>) -> NoContent {
drop(body.into_inner());
NoContent
}
#[kynos::get("/floor/out")]
async fn floor_out() -> NoContent {
NoContent
}
#[kynos::post("/form")]
async fn decode(Form(reading): Form<Reading>) -> NoContent {
let _ = reading;
NoContent
}
#[kynos::get("/form/out")]
async fn encode() -> Form<Reading> {
Form(Reading { id: 7, value: 11 })
}
fn service() -> Service<()> {
Router::<()>::new()
.mount(kynos::routes![
floor,
floor_bytes,
floor_out,
decode,
encode
])
.build(())
.expect("a describable router")
}
fn floor_request() -> Request {
request(Method::POST, "/floor", None, b"")
}
fn transport_request() -> Request {
request(
Method::POST,
"/floor/bytes",
Some("application/octet-stream"),
BODY,
)
}
fn responding_floor_request() -> Request {
request(Method::GET, "/floor/out", None, b"")
}
fn decode_request() -> Request {
request(
Method::POST,
"/form",
Some("application/x-www-form-urlencoded"),
BODY,
)
}
fn encode_request() -> Request {
request(Method::GET, "/form/out", None, b"")
}
const RECORDED: Table = Table {
bodyless_floor: ("POST /floor", floor_request, StatusCode::NO_CONTENT, 7),
transport_floor: (
"POST /floor/bytes",
transport_request,
StatusCode::NO_CONTENT,
8,
),
responding_floor: (
"GET /floor/out",
responding_floor_request,
StatusCode::NO_CONTENT,
7,
),
decoding: ("POST /form", decode_request, StatusCode::NO_CONTENT, 8),
encoding: ("GET /form/out", encode_request, StatusCode::OK, 13),
};
#[test]
fn the_operations_cost_what_is_recorded() {
harness::record(&service(), &RECORDED);
}
#[test]
fn decoding_a_body_costs_more_than_reading_the_same_octets() {
harness::decoding_costs_more_than_the_read(&service(), &RECORDED);
}
#[test]
fn writing_a_body_costs_more_than_the_status_alone() {
harness::writing_costs_more_than_the_status(&service(), &RECORDED);
}
#[test]
fn a_replayed_request_costs_what_the_first_one_did() {
harness::replay(&service(), &RECORDED, 1_000);
}
}
#[cfg(feature = "multipart")]
mod multipart {
use kynos::{
extract::{
body::{binary::Binary, multipart::MultipartForm},
media::OctetStream,
},
http::{Method, Request, StatusCode},
prelude::*,
router::service::Service,
};
use crate::{
counting::request,
harness::{self, Table},
};
#[derive(Schema, kynos::MultipartForm)]
struct Upload {
note: String,
}
const BODY: &[u8] =
b"--kynos\r\nContent-Disposition: form-data; name=\"note\"\r\n\r\nseven\r\n--kynos--\r\n";
#[kynos::post("/floor")]
async fn floor() -> NoContent {
NoContent
}
#[kynos::post("/floor/bytes")]
async fn floor_bytes(body: Binary<OctetStream>) -> NoContent {
drop(body.into_inner());
NoContent
}
#[kynos::get("/floor/out")]
async fn floor_out() -> NoContent {
NoContent
}
#[kynos::post("/multipart")]
async fn decode(MultipartForm(upload): MultipartForm<Upload>) -> NoContent {
drop(upload);
NoContent
}
#[kynos::get("/multipart/out")]
async fn encode() -> MultipartForm<Upload> {
MultipartForm(Upload {
note: "seven".to_owned(),
})
}
fn service() -> Service<()> {
Router::<()>::new()
.mount(kynos::routes![
floor,
floor_bytes,
floor_out,
decode,
encode
])
.build(())
.expect("a describable router")
}
fn floor_request() -> Request {
request(Method::POST, "/floor", None, b"")
}
fn transport_request() -> Request {
request(
Method::POST,
"/floor/bytes",
Some("application/octet-stream"),
BODY,
)
}
fn responding_floor_request() -> Request {
request(Method::GET, "/floor/out", None, b"")
}
fn decode_request() -> Request {
request(
Method::POST,
"/multipart",
Some("multipart/form-data; boundary=kynos"),
BODY,
)
}
fn encode_request() -> Request {
request(Method::GET, "/multipart/out", None, b"")
}
const RECORDED: Table = Table {
bodyless_floor: ("POST /floor", floor_request, StatusCode::NO_CONTENT, 7),
transport_floor: (
"POST /floor/bytes",
transport_request,
StatusCode::NO_CONTENT,
8,
),
responding_floor: (
"GET /floor/out",
responding_floor_request,
StatusCode::NO_CONTENT,
7,
),
decoding: (
"POST /multipart",
decode_request,
StatusCode::NO_CONTENT,
31,
),
encoding: ("GET /multipart/out", encode_request, StatusCode::OK, 26),
};
#[test]
fn the_operations_cost_what_is_recorded() {
harness::record(&service(), &RECORDED);
}
#[test]
fn decoding_a_body_costs_more_than_reading_the_same_octets() {
let (_, transport, decoding) =
harness::decoding_costs_more_than_the_read(&service(), &RECORDED);
assert!(
decoding > transport,
"POST /multipart allocated {decoding}, where reading the same \
octets unparsed allocated {transport}; every part this codec \
produces owns its name, so there is no body it could decode for \
what the read alone costs"
);
}
#[test]
fn writing_a_body_costs_more_than_the_status_alone() {
harness::writing_costs_more_than_the_status(&service(), &RECORDED);
}
#[test]
fn a_replayed_request_costs_what_the_first_one_did() {
harness::replay(&service(), &RECORDED, 1_000);
}
}
#[cfg(feature = "protobuf")]
mod protobuf {
use kynos::{
extract::{
body::{binary::Binary, protobuf::Protobuf},
media::OctetStream,
},
http::{Method, Request, StatusCode},
prelude::*,
router::service::Service,
};
use crate::{
counting::request,
harness::{self, Table},
};
#[derive(Clone, PartialEq, prost::Message, Schema)]
struct Reading {
#[prost(uint64, tag = "1")]
id: u64,
#[prost(uint64, tag = "2")]
value: u64,
}
const BODY: &[u8] = b"\x08\x07\x10\x0b";
#[kynos::post("/floor")]
async fn floor() -> NoContent {
NoContent
}
#[kynos::post("/floor/bytes")]
async fn floor_bytes(body: Binary<OctetStream>) -> NoContent {
drop(body.into_inner());
NoContent
}
#[kynos::get("/floor/out")]
async fn floor_out() -> NoContent {
NoContent
}
#[kynos::post("/protobuf")]
async fn decode(Protobuf(reading): Protobuf<Reading>) -> NoContent {
let _ = reading;
NoContent
}
#[kynos::get("/protobuf/out")]
async fn encode() -> Protobuf<Reading> {
Protobuf(Reading { id: 7, value: 11 })
}
fn service() -> Service<()> {
Router::<()>::new()
.mount(kynos::routes![
floor,
floor_bytes,
floor_out,
decode,
encode
])
.build(())
.expect("a describable router")
}
fn floor_request() -> Request {
request(Method::POST, "/floor", None, b"")
}
fn transport_request() -> Request {
request(
Method::POST,
"/floor/bytes",
Some("application/octet-stream"),
BODY,
)
}
fn responding_floor_request() -> Request {
request(Method::GET, "/floor/out", None, b"")
}
fn decode_request() -> Request {
request(
Method::POST,
"/protobuf",
Some("application/protobuf"),
BODY,
)
}
fn encode_request() -> Request {
request(Method::GET, "/protobuf/out", None, b"")
}
const RECORDED: Table = Table {
bodyless_floor: ("POST /floor", floor_request, StatusCode::NO_CONTENT, 7),
transport_floor: (
"POST /floor/bytes",
transport_request,
StatusCode::NO_CONTENT,
8,
),
responding_floor: (
"GET /floor/out",
responding_floor_request,
StatusCode::NO_CONTENT,
7,
),
decoding: ("POST /protobuf", decode_request, StatusCode::NO_CONTENT, 8),
encoding: ("GET /protobuf/out", encode_request, StatusCode::OK, 11),
};
#[test]
fn the_operations_cost_what_is_recorded() {
harness::record(&service(), &RECORDED);
}
#[test]
fn decoding_a_body_costs_more_than_reading_the_same_octets() {
harness::decoding_costs_more_than_the_read(&service(), &RECORDED);
}
#[test]
fn writing_a_body_costs_more_than_the_status_alone() {
harness::writing_costs_more_than_the_status(&service(), &RECORDED);
}
#[test]
fn a_replayed_request_costs_what_the_first_one_did() {
harness::replay(&service(), &RECORDED, 1_000);
}
}
#[cfg(feature = "compression")]
mod compression {
use std::sync::LazyLock;
use kynos::{
extract::{body::binary::Binary, media::OctetStream},
http::{HeaderValue, Method, Request, StatusCode, header},
middleware::compression::Compression,
prelude::*,
router::service::Service,
};
use crate::{counting::request, harness::counted_carrying};
static BODIES: LazyLock<[bytes::Bytes; 4]> =
LazyLock::new(|| SIZES.map(|(_, _, length, _)| octets(length)));
fn octets(length: usize) -> bytes::Bytes {
let mut octets = Vec::with_capacity(length);
let mut index = 0_u32;
while octets.len() < length {
octets.extend_from_slice(
format!("{index:x} the quick brown fox {}\n", index % 97).as_bytes(),
);
index += 1;
}
octets.truncate(length);
bytes::Bytes::from(octets)
}
#[kynos::get("/bytes/0")]
async fn empty() -> Binary<OctetStream> {
Binary::new(BODIES[0].clone())
}
#[kynos::get("/bytes/1k")]
async fn small() -> Binary<OctetStream> {
Binary::new(BODIES[1].clone())
}
#[kynos::get("/bytes/16k")]
async fn medium() -> Binary<OctetStream> {
Binary::new(BODIES[2].clone())
}
#[kynos::get("/bytes/256k")]
async fn large() -> Binary<OctetStream> {
Binary::new(BODIES[3].clone())
}
fn mounted() -> Service<()> {
Router::<()>::new()
.mount(kynos::routes![empty, small, medium, large])
.intercept(Compression::new())
.build(())
.expect("a describable router")
}
fn unmounted() -> Service<()> {
Router::<()>::new()
.mount(kynos::routes![empty, small, medium, large])
.build(())
.expect("a describable router")
}
fn asking(accept: &'static str, target: &str) -> Request {
let mut request = request(Method::GET, target, None, b"");
request
.headers_mut()
.insert(header::ACCEPT_ENCODING, HeaderValue::from_static(accept));
request
}
const SIZES: [(&str, &str, usize, usize); 4] = [
("0", "/bytes/0", 0, 1_000),
("1 KiB", "/bytes/1k", 1024, 1_000),
("16 KiB", "/bytes/16k", 16 * 1024, 200),
("256 KiB", "/bytes/256k", 256 * 1024, 25),
];
const CODINGS: [&str; 3] = ["gzip", "br", "zstd"];
fn carried(accept: &str, length: usize) -> Option<&str> {
(accept != "identity" && length > 0).then_some(accept)
}
const DRAIN_CHUNK: usize = 8 * 1024;
fn drained(length: usize) -> usize {
length.div_ceil(DRAIN_CHUNK)
}
const RECORDED: [(&str, [usize; 4]); 4] = [
("identity", [14, 14, 14, 14]),
("gzip", [14, 27, 27, 31]),
("br", [14, 42, 42, 48]),
("zstd", [14, 21, 21, 24]),
];
const UNMOUNTED: usize = 10;
#[test]
fn the_operations_cost_what_is_recorded() {
LazyLock::force(&BODIES);
let service = mounted();
let mut over = Vec::new();
for (accept, ceilings) in RECORDED {
for ((size, target, length, _), ceiling) in SIZES.into_iter().zip(ceilings) {
let counted = counted_carrying(
&service,
asking(accept, target),
StatusCode::OK,
carried(accept, length),
);
if counted > ceiling {
over.push(format!(
"{accept} at {size} allocated {counted}, recorded {ceiling}"
));
}
}
}
let counted = counted_carrying(
&unmounted(),
asking("identity", "/bytes/16k"),
StatusCode::OK,
None,
);
if counted > UNMOUNTED {
over.push(format!(
"unmounted at 16 KiB allocated {counted}, recorded {UNMOUNTED}"
));
}
assert!(
over.is_empty(),
"{over:?}; the ceiling is `RECORDED` in this file, which is where \
this number lives — the register row that sanctions it is filed by \
#121 under docs/nfr.md#middleware and is not there yet, so until \
then raising one is a change to this table alone, and lowering one \
is what a cheaper encoder looks like"
);
}
#[test]
fn mounting_compression_costs_the_operation_that_carries_it() {
LazyLock::force(&BODIES);
let with = counted_carrying(
&mounted(),
asking("identity", "/bytes/16k"),
StatusCode::OK,
None,
);
let without = counted_carrying(
&unmounted(),
asking("identity", "/bytes/16k"),
StatusCode::OK,
None,
);
assert!(
with > without,
"an operation under Compression ({with}) should cost more than the \
same operation without it ({without}), with the encoder declining \
on both sides"
);
}
#[test]
fn a_body_left_alone_costs_less_than_one_encoded() {
LazyLock::force(&BODIES);
let service = mounted();
let (_, empty_target, empty_length, _) = SIZES[0];
for coding in CODINGS {
let empty = counted_carrying(
&service,
asking(coding, empty_target),
StatusCode::OK,
carried(coding, empty_length),
);
for (size, target, length, _) in SIZES.into_iter().skip(1) {
let declined =
counted_carrying(&service, asking("identity", target), StatusCode::OK, None);
let encoded = counted_carrying(
&service,
asking(coding, target),
StatusCode::OK,
carried(coding, length),
);
assert!(
encoded > declined,
"{coding} on {size} ({encoded}) should cost more than the \
same response the client asked for as identity ({declined})"
);
assert!(
encoded > empty,
"{coding} on {size} ({encoded}) should cost more than \
{coding} on a body too small to be worth encoding \
({empty})"
);
}
}
}
#[test]
fn the_encoders_delta_grows_with_the_body_and_no_faster() {
LazyLock::force(&BODIES);
let service = mounted();
for coding in CODINGS {
let deltas = SIZES.map(|(size, target, length, _)| {
let engaged = counted_carrying(
&service,
asking(coding, target),
StatusCode::OK,
carried(coding, length),
);
let alone =
counted_carrying(&service, asking("identity", target), StatusCode::OK, None);
assert!(
engaged >= alone,
"{coding} at {size} allocated {engaged}, where the same \
response left alone allocated {alone}; engaging an encoder \
cannot cost less than declining to, so a difference that \
runs backwards is two readings of different things rather \
than a delta"
);
engaged - alone
});
for pair in deltas.windows(2) {
assert!(
pair[0] <= pair[1],
"{coding} allocated {deltas:?} over {SIZES:?}; a delta that \
falls as the body grows is a measurement of something else"
);
}
for larger in 2..SIZES.len() {
let smaller = larger - 1;
let allowance = drained(SIZES[larger].2) - 1;
let growth = deltas[larger] - deltas[smaller];
assert!(
growth <= allowance,
"{coding} allocated {deltas:?} over {SIZES:?}; the delta grew \
by {growth} from {} to {}, where the drain that produces it \
takes at most {allowance} further reads of {DRAIN_CHUNK} \
octets — a delta outgrowing its drain is a buffer growing \
by doubling from nothing on every response, or state kept \
per octet",
SIZES[smaller].0,
SIZES[larger].0
);
}
}
}
#[test]
fn a_replayed_request_costs_what_the_first_one_did() {
LazyLock::force(&BODIES);
let service = mounted();
for (accept, _) in RECORDED {
for (size, target, length, replays) in SIZES {
let carried = carried(accept, length);
let first =
counted_carrying(&service, asking(accept, target), StatusCode::OK, carried);
let mut moved = Vec::new();
for index in 0..replays {
let counted =
counted_carrying(&service, asking(accept, target), StatusCode::OK, carried);
if counted != first {
moved.push((index, counted));
}
}
assert!(
moved.is_empty(),
"{accept} at {size} allocated {first} times on one request \
and differently on {} of the next {replays}, starting at \
{:?}; a count that moves between identical requests is \
state accumulating in the encoder",
moved.len(),
moved.first()
);
}
}
}
}