pub struct PluginInstance { /* private fields */ }Expand description
A per-request plugin instance: a wasmtime store + instance.
Implementations§
Source§impl PluginInstance
impl PluginInstance
Sourcepub fn on_request_headers(
&mut self,
headers: Vec<(String, String)>,
) -> PhaseResult
pub fn on_request_headers( &mut self, headers: Vec<(String, String)>, ) -> PhaseResult
Call proxy_on_request_headers(context_id, num_headers, end_of_stream).
Sets the request headers in the context before calling.
Sourcepub fn on_request_body(&mut self, body: Vec<u8>) -> PhaseResult
pub fn on_request_body(&mut self, body: Vec<u8>) -> PhaseResult
Call proxy_on_request_body(context_id, body_size, end_of_stream).
Sets the request body in the context before calling.
Sourcepub fn on_response_headers(
&mut self,
headers: Vec<(String, String)>,
) -> PhaseResult
pub fn on_response_headers( &mut self, headers: Vec<(String, String)>, ) -> PhaseResult
Call proxy_on_response_headers(context_id, num_headers, end_of_stream).
Sets the response headers in the context before calling.
Sourcepub fn on_response_body(&mut self, body: Vec<u8>) -> PhaseResult
pub fn on_response_body(&mut self, body: Vec<u8>) -> PhaseResult
Call proxy_on_response_body(context_id, body_size, end_of_stream).
Sets the response body in the context before calling.
Sourcepub fn request_headers(&self) -> &[(String, String)]
pub fn request_headers(&self) -> &[(String, String)]
Get the (possibly modified) request headers from the context.
Sourcepub fn response_headers(&self) -> &[(String, String)]
pub fn response_headers(&self) -> &[(String, String)]
Get the (possibly modified) response headers from the context.
Sourcepub fn request_body(&self) -> &[u8] ⓘ
pub fn request_body(&self) -> &[u8] ⓘ
Get the (possibly modified) request body from the context.
Sourcepub fn response_body(&self) -> &[u8] ⓘ
pub fn response_body(&self) -> &[u8] ⓘ
Get the (possibly modified) response body from the context.
Sourcepub fn memory_bytes(&mut self, offset: usize, len: usize) -> Option<Vec<u8>>
pub fn memory_bytes(&mut self, offset: usize, len: usize) -> Option<Vec<u8>>
Read len bytes of the plugin’s linear memory at offset
(test support: asserting a callback’s in-memory side effects).
A snapshot of the VM-scoped shared-data map (test support: the cross-instance store DW-167 introduced).
Sourcepub fn take_pending_callouts(&mut self) -> Vec<PendingCallout>
pub fn take_pending_callouts(&mut self) -> Vec<PendingCallout>
Drain the callouts registered since the last phase/callback invocation (DW-167). The dispatch driver performs them in FIFO order (one round each).
Sourcepub fn requeue_callouts(&mut self, pending: Vec<PendingCallout>)
pub fn requeue_callouts(&mut self, pending: Vec<PendingCallout>)
Re-enqueue callouts the dispatch driver drained but did NOT perform (DW-167): when the first of several queued deliveries re-dispatches from its callback, the un-performed remainder goes back AHEAD of the newly registered queue — preserving the global dispatch order and guaranteeing every dispatched callout is eventually performed (or the loop guard trips).
Sourcepub fn deliver_callout_response(
&mut self,
token: u32,
resp: &CalloutResponse,
) -> PhaseResult
pub fn deliver_callout_response( &mut self, token: u32, resp: &CalloutResponse, ) -> PhaseResult
Deliver a completed callout response and collect the plugin’s
resumed outcome (DW-167): the response’s headers (:status
first, hop-by-hop stripped) and body land in the context’s
callout-response stores, then the host calls
proxy_on_http_call_response(context_id, token, num_headers, body_size, num_trailers) — the 5-parameter shape the Rust SDK
0.2.5 exports (its first parameter is the ABI’s context slot,
which the SDK ignores; it routes by token inside the module).
The export returns nothing in the SDK: the plugin’s decision is
expressed through what it does inside the callback
(send_http_response, header mutations, another dispatch, or
nothing = resume Continue). A module without the export resumes
Continue (nothing to tell).
Auto Trait Implementations§
impl Freeze for PluginInstance
impl !RefUnwindSafe for PluginInstance
impl Send for PluginInstance
impl Sync for PluginInstance
impl Unpin for PluginInstance
impl !UnwindSafe for PluginInstance
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§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
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more