diff --git a/benches/token_router.rs b/benches/token_router.rs index 7afda6b58..51dd0effd 100644 --- a/benches/token_router.rs +++ b/benches/token_router.rs @@ -31,22 +31,31 @@ fn token_router(b: Bencher, token_kind: &str) { use rand::seq::SliceRandom as _; let tok = tokens.choose(&mut rand).unwrap(); - let mut rc = quilkin::filters::ReadContext::new( - cm.clone(), - quilkin::net::EndpointAddress::LOCALHOST, - pool.clone().alloc(), - ); - rc.metadata.insert( + let mut metadata = quilkin::net::endpoint::DynamicMetadata::default(); + metadata.insert( quilkin::net::endpoint::metadata::Key::from_static( quilkin::filters::capture::CAPTURED_BYTES, ), quilkin::net::endpoint::metadata::Value::Bytes((*tok).clone().into()), ); - rc + ( + cm.clone(), + pool.clone().alloc(), + Vec::with_capacity(1), + metadata, + ) }) .counter(divan::counter::BytesCount::new(total_token_size)) - .bench_local_values(|mut rc| { + .bench_local_values(|(cm, buffer, mut dest, metadata)| { + let mut rc = quilkin::filters::ReadContext { + endpoints: cm, + destinations: &mut dest, + source: quilkin::net::EndpointAddress::LOCALHOST, + contents: buffer, + metadata, + }; + let _ = divan::black_box(filter.sync_read(&mut rc)); }) } diff --git a/src/filters/read.rs b/src/filters/read.rs index 5927acee4..2eab8f6a9 100644 --- a/src/filters/read.rs +++ b/src/filters/read.rs @@ -27,7 +27,6 @@ use crate::{ }; /// The input arguments to [`Filter::read`]. -#[non_exhaustive] pub struct ReadContext<'ctx> { /// The upstream endpoints that the packet will be forwarded to. pub endpoints: Arc,