pub struct LuaMiddleware { /* private fields */ }Expand description
SpawnerLayer that runs Lua source as a before-gate and/or an
after-transform around a spawn, executed on a pooled AsyncIslePool
VM. See the module doc for the exact function shapes expected of
before_src / after_src.
Implementations§
Source§impl LuaMiddleware
impl LuaMiddleware
Sourcepub fn before(self, src: impl Into<String>) -> Self
pub fn before(self, src: impl Into<String>) -> Self
Sets the before-hook source (function(ctx_table) ... end).
Raising from this function rejects the spawn.
Sourcepub fn after(self, src: impl Into<String>) -> Self
pub fn after(self, src: impl Into<String>) -> Self
Sets the after-hook source
(function(ctx_table, result_table) return result end). Its
return value replaces the worker’s result.
Sourcepub fn with_pool(self, pool: Arc<AsyncIslePool>) -> Self
pub fn with_pool(self, pool: Arc<AsyncIslePool>) -> Self
Inject an externally-built AsyncIslePool. Useful when the caller wants to share a pool with another Lua layer or carry VM initialisation across calls.
Trait Implementations§
Source§impl Clone for LuaMiddleware
impl Clone for LuaMiddleware
Source§fn clone(&self) -> LuaMiddleware
fn clone(&self) -> LuaMiddleware
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for LuaMiddleware
impl Default for LuaMiddleware
Source§fn default() -> LuaMiddleware
fn default() -> LuaMiddleware
Returns the “default value” for a type. Read more
Source§impl SpawnerLayer for LuaMiddleware
impl SpawnerLayer for LuaMiddleware
Source§fn wrap(&self, inner: Arc<dyn SpawnerAdapter>) -> Arc<dyn SpawnerAdapter> ⓘ
fn wrap(&self, inner: Arc<dyn SpawnerAdapter>) -> Arc<dyn SpawnerAdapter> ⓘ
Wraps
inner in this layer’s behaviour, returning a new
SpawnerAdapter that delegates to inner (directly or via
wrap_join) while adding this layer’s cross-cutting effect.Auto Trait Implementations§
impl !RefUnwindSafe for LuaMiddleware
impl !UnwindSafe for LuaMiddleware
impl Freeze for LuaMiddleware
impl Send for LuaMiddleware
impl Sync for LuaMiddleware
impl Unpin for LuaMiddleware
impl UnsafeUnpin for LuaMiddleware
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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