pub struct PluginHandler<CTP: ConnectionToPlugin> { /* private fields */ }Expand description
The core structure handling the pluginization of connections.
Implementations§
Source§impl<CTP: ConnectionToPlugin> PluginHandler<CTP>
impl<CTP: ConnectionToPlugin> PluginHandler<CTP>
Sourcepub fn new(
exports_func: fn(&mut Store, &FunctionEnv<Env<CTP>>) -> Exports,
) -> Self
pub fn new( exports_func: fn(&mut Store, &FunctionEnv<Env<CTP>>) -> Exports, ) -> Self
Create a new PluginHandler, enabling the execution of plugins inserted on the fly to
customize the behavior of a connection.
Sourcepub fn set_pluginizable_connection(
&mut self,
conn: *const PluginizableConnection<CTP>,
) -> bool
pub fn set_pluginizable_connection( &mut self, conn: *const PluginizableConnection<CTP>, ) -> bool
Set the pointer to the connection context. This pointer must be pinned.
Sourcepub fn insert_plugin(&mut self, plugin_fname: &PathBuf) -> Result<(), Error>
pub fn insert_plugin(&mut self, plugin_fname: &PathBuf) -> Result<(), Error>
Attach a new plugin whose bytecode is accessible through the provided path. Return whether
the insertion succeeded, or the related Error otherwise.
If the insertion succeeds and the plugin provides an init function as a protocol
operation, this function calls it. This can be useful to, e.g., initialize a plugin-specific
structure or register new frames.
Sourcepub fn provides(&self, po: &PluginOp, anchor: Anchor) -> bool
pub fn provides(&self, po: &PluginOp, anchor: Anchor) -> bool
Return whether there is a bytecode providing the plugin operation at the requested anchor.
Sourcepub fn on_timeout(&mut self, t: Instant) -> Result<(), Error>
pub fn on_timeout(&mut self, t: Instant) -> Result<(), Error>
Call potential timeouts that fired since the provided time.
If there were not firing timers, this method does nothing.
Sourcepub fn get_conn(&self) -> Option<&PluginizableConnection<CTP>>
pub fn get_conn(&self) -> Option<&PluginizableConnection<CTP>>
Get an immutable reference to the serving connection.
Sourcepub fn get_conn_mut(&mut self) -> Option<&mut PluginizableConnection<CTP>>
pub fn get_conn_mut(&mut self) -> Option<&mut PluginizableConnection<CTP>>
Get an mutable reference to the serving connection.
Sourcepub fn add_bytes_content(&mut self, bc: BytesContent) -> Bytes
pub fn add_bytes_content(&mut self, bc: BytesContent) -> Bytes
Set bytes content, to be available through a Bytes value by the plugin.
Sourcepub fn clear_bytes_content(&mut self)
pub fn clear_bytes_content(&mut self)
Clear the content made available to the plugin.
This method must always be called once the plugin operation call completes. This is automatically done by the helping macros.
Sourcepub fn add_registration(&mut self, r: Registration)
pub fn add_registration(&mut self, r: Registration)
Register some plugin Registration.
Sourcepub fn get_registrations(&self) -> &[Registration]
pub fn get_registrations(&self) -> &[Registration]
Return all the Registrations that are known by the pluginization handler.
Sourcepub fn call_direct(
&mut self,
po: &PluginOp,
anchor: Anchor,
params: &[PluginVal],
) -> Result<(), Error>
pub fn call_direct( &mut self, po: &PluginOp, anchor: Anchor, params: &[PluginVal], ) -> Result<(), Error>
Only for BEFORE or AFTER calls.
Trait Implementations§
Auto Trait Implementations§
impl<CTP> Freeze for PluginHandler<CTP>
impl<CTP> !RefUnwindSafe for PluginHandler<CTP>
impl<CTP> Send for PluginHandler<CTP>
impl<CTP> !Sync for PluginHandler<CTP>
impl<CTP> !Unpin for PluginHandler<CTP>
impl<CTP> !UnwindSafe for PluginHandler<CTP>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.