pub struct BodyAccessControl { /* private fields */ }Expand description
Holds the split state: body-less JSON metadata and the raw body bytes.
Created once before the middleware chain runs. The body is only injected
(via side-channel) for middlewares that declare body_access = true.
Implementations§
Source§impl BodyAccessControl
impl BodyAccessControl
Sourcepub fn new(metadata_json: Vec<u8>, body: Option<Vec<u8>>) -> Self
pub fn new(metadata_json: Vec<u8>, body: Option<Vec<u8>>) -> Self
Create a new body access controller.
metadata_json is the serialized Request/Response (body is #[serde(skip)]
so it’s already absent from JSON). body is the raw body bytes extracted
from the original struct before serialization.
Sourcepub fn prepare_instance(
&self,
instance: &mut PluginInstance,
body_access: bool,
) -> Vec<u8> ⓘ
pub fn prepare_instance( &self, instance: &mut PluginInstance, body_access: bool, ) -> Vec<u8> ⓘ
Prepare an instance for a middleware call.
If body_access is true, the held body is set on the instance via
side-channel. Otherwise, no body is set (plugin sees None).
Returns a clone of the metadata JSON to pass to the WASM handler.
Sourcepub fn collect_after(
&mut self,
instance: &mut PluginInstance,
output: Vec<u8>,
body_access: bool,
)
pub fn collect_after( &mut self, instance: &mut PluginInstance, output: Vec<u8>, body_access: bool, )
Collect results after a middleware call.
output is the metadata JSON returned by the plugin (via take_output()).
If body_access is true, the output body is taken from the instance’s
side-channel and updates the held body.
Auto Trait Implementations§
impl Freeze for BodyAccessControl
impl RefUnwindSafe for BodyAccessControl
impl Send for BodyAccessControl
impl Sync for BodyAccessControl
impl Unpin for BodyAccessControl
impl UnsafeUnpin for BodyAccessControl
impl UnwindSafe for BodyAccessControl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request