config

Struct LuaConfig

Source
pub struct LuaConfig { /* private fields */ }

Implementations§

Source§

impl LuaConfig

Source

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

Source

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.

Source

pub async fn async_call_callback<A: IntoLuaMulti + Clone, R: FromLuaMulti + Default>( &mut self, sig: &CallbackSignature<A, R>, args: A, ) -> Result<R>

Source

pub async fn async_call_callback_non_default<A: IntoLuaMulti + Clone, R: FromLuaMulti>( &mut self, sig: &CallbackSignature<A, R>, args: A, ) -> Result<R>

Source

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>>

Source

pub fn remove_registry_value(&mut self, value: RegistryKey) -> Result<()>

Source

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

Source

pub async fn with_registry_value<F, R, FUT>( &mut self, value: &RegistryKey, func: F, ) -> Result<R>
where R: FromLuaMulti, F: FnOnce(Value) -> Result<FUT>, FUT: Future<Output = Result<R>>,

Operate on an object/value that was previously constructed via async_call_ctor.

Trait Implementations§

Source§

impl Debug for LuaConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> MaybeSend for T
where T: Send,