Context

Struct Context 

Source
pub struct Context<'gc> { /* private fields */ }

Implementations§

Source§

impl<'gc> Context<'gc>

Source

pub fn globals(self) -> Table<'gc>

Source

pub fn registry(self) -> Registry<'gc>

Source

pub fn interned_strings(self) -> InternedStringSet<'gc>

Source

pub fn finalizers(self) -> Finalizers<'gc>

Source

pub fn set_global<K: IntoValue<'gc>, V: IntoValue<'gc>>( self, key: K, value: V, ) -> Result<Value<'gc>, InvalidTableKey>

Calls ctx.globals().set(ctx, key, value).

Source

pub fn get_global<K: IntoValue<'gc>>(self, key: K) -> Value<'gc>

Calls ctx.globals().get(ctx, key).

Source

pub fn singleton<S>(self) -> &'gc Root<'gc, S>
where S: for<'a> Rootable<'a>, Root<'gc, S>: Singleton<'gc>,

Calls ctx.registry().singleton::<S>(ctx).

Source

pub fn stash<S: Stashable<'gc>>(self, s: S) -> S::Stashed

Calls ctx.registry().stash(ctx, s).

Source

pub fn fetch<F: Fetchable<'gc>>(self, f: &F) -> F::Fetched

Calls ctx.registry().fetch(f).

Source

pub fn intern(self, s: &[u8]) -> String<'gc>

Calls ctx.interned_strings().intern(&ctx, s).

Source

pub fn intern_static(self, s: &'static [u8]) -> String<'gc>

Calls ctx.interned_strings().intern_static(&ctx, s).

Methods from Deref<Target = Mutation<'gc>>§

Source

pub fn metrics(&self) -> &Metrics

Trait Implementations§

Source§

impl<'gc> Clone for Context<'gc>

Source§

fn clone(&self) -> Context<'gc>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'gc> Deref for Context<'gc>

Source§

type Target = Mutation<'gc>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'gc> Copy for Context<'gc>

Auto Trait Implementations§

§

impl<'gc> Freeze for Context<'gc>

§

impl<'gc> !RefUnwindSafe for Context<'gc>

§

impl<'gc> !Send for Context<'gc>

§

impl<'gc> !Sync for Context<'gc>

§

impl<'gc> Unpin for Context<'gc>

§

impl<'gc> !UnwindSafe for Context<'gc>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

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

Source§

fn vzip(self) -> V