pub struct PluginInstance { /* private fields */ }
Expand description
An instance of a Plugin
, associated with a RequestContext
.
Implementations§
Source§impl PluginInstance
impl PluginInstance
Sourcepub async fn new(
plugin: Arc<Plugin>,
request_context: RequestContext,
) -> Result<PluginInstance, PluginInstantiationError>
pub async fn new( plugin: Arc<Plugin>, request_context: RequestContext, ) -> Result<PluginInstance, PluginInstantiationError>
Sourcepub fn stdio(&self) -> PluginStdio
pub fn stdio(&self) -> PluginStdio
Returns stdout
and stderr
captured during plugin execution.
Sourcepub fn receive_request_body(&self) -> bool
pub fn receive_request_body(&self) -> bool
Returns whether this plugin instance expects to process a request body.
Sourcepub fn receive_response_body(&self) -> bool
pub fn receive_response_body(&self) -> bool
Returns whether this plugin instance expects to process a response body.
Sourcepub fn record_request(&mut self, request: Arc<Request>)
pub fn record_request(&mut self, request: Arc<Request>)
Records a Request
so that it will be accessible to the plugin guest
environment. Overwrites the existing Request
.
Sourcepub fn record_response(&mut self, response: Arc<Response>)
pub fn record_response(&mut self, response: Arc<Response>)
Records a Response
so that it will be accessible to the plugin guest
environment.
Sourcepub fn record_combined_decision(
&mut self,
decision_components: &DecisionComponents,
outcome: Outcome,
)
pub fn record_combined_decision( &mut self, decision_components: &DecisionComponents, outcome: Outcome, )
Sourcepub fn plugin_reference(&self) -> String
pub fn plugin_reference(&self) -> String
Returns the plugin’s identifier.
Sourcepub async fn handle_init(&mut self) -> Result<(), PluginExecutionError>
pub async fn handle_init(&mut self) -> Result<(), PluginExecutionError>
Executes the guest’s init
function.
Sourcepub async fn handle_request(&mut self) -> Result<(), PluginExecutionError>
pub async fn handle_request(&mut self) -> Result<(), PluginExecutionError>
Executes the guest’s on_request
function.
Sourcepub async fn handle_request_decision(
&mut self,
) -> Result<(), PluginExecutionError>
pub async fn handle_request_decision( &mut self, ) -> Result<(), PluginExecutionError>
Executes the guest’s on_request_decision
function.
Sourcepub async fn handle_response_decision(
&mut self,
) -> Result<(), PluginExecutionError>
pub async fn handle_response_decision( &mut self, ) -> Result<(), PluginExecutionError>
Executes the guest’s on_response_decision
function.
Sourcepub async fn handle_request_body_decision(
&mut self,
) -> Result<(), PluginExecutionError>
pub async fn handle_request_body_decision( &mut self, ) -> Result<(), PluginExecutionError>
Executes the guest’s on_request_body_decision
function.
Sourcepub async fn handle_response_body_decision(
&mut self,
) -> Result<(), PluginExecutionError>
pub async fn handle_response_body_decision( &mut self, ) -> Result<(), PluginExecutionError>
Executes the guest’s on_response_body_decision
function.
Sourcepub async fn handle_decision_feedback(
&mut self,
) -> Result<(), PluginExecutionError>
pub async fn handle_decision_feedback( &mut self, ) -> Result<(), PluginExecutionError>
Executes the guest’s on_decision_feedback
function.
Sourcepub fn decision(&mut self) -> DecisionComponents
pub fn decision(&mut self) -> DecisionComponents
Returns the decision components from the RequestContext
.
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§
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> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self
file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self
file descriptor. Read moreSource§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 more