pub struct LuaConfig { /* private fields */ }
Implementations§
Source§impl LuaConfig
impl LuaConfig
Sourcepub async fn convert_args_and_call_callback<A: Serialize>(
&mut self,
sig: &CallbackSignature<Value, ()>,
args: A,
) -> Result<()>
pub async fn convert_args_and_call_callback<A: Serialize>( &mut self, sig: &CallbackSignature<Value, ()>, args: A, ) -> Result<()>
Intended to be used together with kumo.spawn_task
Sourcepub fn put(self)
pub fn put(self)
Explicitly put the config object back into its containing pool. Ideally we’d do this automatically when the object is dropped, but lua’s garbage collection makes this problematic: if a future whose graph contains an async lua call within this config object is cancelled (eg: simply stopped without calling it again), and the config object is not explicitly garbage collected, any futures and data owned by any dependencies of the cancelled future remain alive until the next gc run, which can cause things like async locks and semaphores to have a lifetime extended by the maximum age of the lua context.
The combat this, consumers of LuaConfig should explicitly
call config.put()
after successfully using the config
object.
Or framing it another way: consumers must not call config.put()
if a transitive dep might have been cancelled.
pub async fn async_call_callback<A: IntoLuaMulti + Clone, R: FromLuaMulti + Default>( &mut self, sig: &CallbackSignature<A, R>, args: A, ) -> Result<R>
pub async fn async_call_callback_non_default<A: IntoLuaMulti + Clone, R: FromLuaMulti>( &mut self, sig: &CallbackSignature<A, R>, args: A, ) -> Result<R>
pub async fn async_call_callback_non_default_opt<A: IntoLuaMulti + Clone, R: FromLua>( &mut self, sig: &CallbackSignature<A, Option<R>>, args: A, ) -> Result<Option<R>>
pub fn remove_registry_value(&mut self, value: RegistryKey) -> Result<()>
Sourcepub async fn async_call_ctor<A: IntoLuaMulti + Clone>(
&mut self,
sig: &CallbackSignature<A, Value>,
args: A,
) -> Result<RegistryKey>
pub async fn async_call_ctor<A: IntoLuaMulti + Clone>( &mut self, sig: &CallbackSignature<A, Value>, args: A, ) -> Result<RegistryKey>
Call a constructor registered via on
. Returns a registry key that can be
used to reference the returned value again later on this same Lua instance
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LuaConfig
impl !RefUnwindSafe for LuaConfig
impl Send for LuaConfig
impl Sync for LuaConfig
impl Unpin for LuaConfig
impl !UnwindSafe for LuaConfig
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
§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