rune::core::gc::root

Struct Rt

Source
#[repr(transparent)]
pub struct Rt<T: ?Sized> { _aliasable: PhantomPinned, inner: T, }
Expand description

A “Root Tracable” type. If a type is wrapped in Rt, it is known to be rooted and hold items past garbage collection. This type is never used as an owned type, only a reference. This ensures that underlying data does not move. In order to access the inner data, use Rt::bind_ref or Rt::bind_mut methods.

Fields§

§_aliasable: PhantomPinned§inner: T

Implementations§

Source§

impl<T> Rt<T>

Source

fn inner(&self) -> &T

Source

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

Source

fn inner_ptr(&self) -> *const T

Source

fn inner_mut_ptr(&mut self) -> *mut T

Source

pub(crate) fn bind_ref<'a, 'ob>( &'a self, _: &'ob Context<'_>, ) -> &'a <T as WithLifetime<'ob>>::Out
where T: WithLifetime<'ob>,

Source

pub(crate) fn bind_mut<'a, 'ob>( &'a mut self, _: &'ob Context<'_>, ) -> &'a mut <T as WithLifetime<'ob>>::Out
where T: WithLifetime<'ob>,

Source

pub(crate) fn set<U: IntoRoot<T>>(&mut self, item: U)

Source§

impl<T> Rt<Slot<T>>

Source

pub(crate) fn bind<'ob>( &self, _: &'ob Context<'_>, ) -> <T as WithLifetime<'ob>>::Out
where T: WithLifetime<'ob> + Copy,

Source

pub(crate) unsafe fn bind_unchecked<'ob>( &'ob self, ) -> <T as WithLifetime<'ob>>::Out
where T: WithLifetime<'ob> + Copy,

Source

pub(crate) fn bind_slice<'brw, 'ob, U>( slice: &'brw [Rt<Slot<Gc<T>>>], _: &'ob Context<'_>, ) -> &'brw [Gc<U>]
where Gc<T>: WithLifetime<'ob, Out = Gc<U>>, Gc<U>: 'ob,

Source§

impl<T> Rt<Slot<Gc<T>>>

Source

pub(crate) fn untag<'ob, U>(&self, cx: &'ob Context<'_>) -> U
where Gc<T>: WithLifetime<'ob, Out = Gc<U>> + Copy, Gc<U>: Untag<U>,

Calls untag on the tagged Gc pointer

Source

pub(crate) fn try_as<U, E>(&self) -> Result<&Rt<Slot<Gc<U>>>, E>
where Gc<T>: TryInto<Gc<U>, Error = E> + Copy,

Like try_into, but needed to due no specialization

Source§

impl<T> Rt<Slot<Gc<T>>>

Source

pub(crate) fn bind_as<'ob, U, E>(&self, _cx: &'ob Context<'_>) -> Result<U, E>
where Gc<T>: WithLifetime<'ob> + Copy, <Gc<T> as WithLifetime<'ob>>::Out: TryInto<U, Error = E> + Copy,

Like try_into().bind(cx), but needed to due no specialization

Source

pub(crate) fn cast<U>(&self) -> &Rt<Slot<Gc<U>>>
where Gc<T>: Into<Gc<U>> + Copy,

Like Into, but needed to due no specialization

Source

pub(crate) fn as_cons(&self) -> &Rt<Slot<Gc<&Cons>>>

Source§

impl<'a> Rt<Slot<Gc<ObjectType<'a>>>>

Source

pub(crate) fn try_as_option<T, E>(&self) -> Result<Option<&Rt<Slot<Gc<T>>>>, E>
where Gc<ObjectType<'a>>: TryInto<Gc<T>, Error = E>,

Source§

impl Rt<Slot<&Cons>>

Source

pub(crate) fn car<'ob>(&self, cx: &'ob Context<'_>) -> Gc<ObjectType<'ob>>

Source

pub(crate) fn cdr<'ob>(&self, cx: &'ob Context<'_>) -> Gc<ObjectType<'ob>>

Source§

impl<T> Rt<Vec<T>>

Source

fn as_mut_ref(&mut self) -> &mut Vec<Rt<T>>

Source

pub(crate) fn push<U: IntoRoot<T>>(&mut self, item: U)

Source

pub(crate) fn truncate(&mut self, len: usize)

Source

pub(crate) fn pop(&mut self)

Source

pub(crate) fn swap_remove(&mut self, index: usize)

Source

pub(crate) fn reserve(&mut self, additional: usize)

Source

pub(crate) fn capacity(&self) -> usize

Source§

impl<T> Rt<Vec<T>>

Source

pub(crate) fn extend_from_slice<U: IntoRoot<T> + Copy>(&mut self, src: &[U])

Source§

impl<T: Clone> Rt<Vec<T>>

Source

pub(crate) fn extend_from_within(&mut self, src: impl RangeBounds<usize>)

Source§

impl<K, V> Rt<ObjectMap<K, V>>
where K: Eq + Hash,

Source

fn as_ref(&self) -> &IndexMap<K, V>

Source

fn as_mut(&mut self) -> &mut IndexMap<K, V>

Source

pub(crate) fn insert<Kx: IntoRoot<K>, Vx: IntoRoot<V>>(&mut self, k: Kx, v: Vx)

Source

pub(crate) fn get<Q: IntoRoot<K>>(&self, k: Q) -> Option<&Rt<V>>

Source

pub(crate) fn get_mut<Q: IntoRoot<K>>(&mut self, k: Q) -> Option<&mut Rt<V>>

Source

pub(crate) fn remove<Q: IntoRoot<K>>(&mut self, k: Q)

Source§

impl Rt<Slot<Gc<FunctionType<'_>>>>

Source

pub(crate) fn call<'ob>( &self, frame: &mut CallFrame<'_, '_>, name: Option<&str>, cx: &'ob mut Context<'_>, ) -> Result<Gc<ObjectType<'ob>>, EvalError>

Trait Implementations§

Source§

impl<T, const N: usize> AsRef<[Rt<T>]> for Rt<[T; N]>

Source§

fn as_ref(&self) -> &[Rt<T>]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T> Hash for Rt<T>
where T: Hash,

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoObject for &Rt<Slot<Gc<ObjectType<'_>>>>

Source§

type Out<'ob> = ObjectType<'ob>

Source§

fn into_obj<const C: bool>(self, _block: &Block<C>) -> Gc<Self::Out<'_>>

Source§

impl IntoObject for &mut Rt<Slot<Gc<ObjectType<'_>>>>

Source§

type Out<'ob> = ObjectType<'ob>

Source§

fn into_obj<const C: bool>(self, _block: &Block<C>) -> Gc<Self::Out<'_>>

Source§

impl<'a, T, U> IntoRoot<Slot<U>> for &Rt<Slot<T>>
where T: WithLifetime<'a, Out = U> + Copy,

Source§

unsafe fn into_root(self) -> Slot<U>

Source§

impl<T, U> PartialEq<U> for Rt<Slot<T>>
where Slot<T>: PartialEq<U>,

Source§

fn eq(&self, other: &U) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialEq + ?Sized> PartialEq for Rt<T>

Source§

fn eq(&self, other: &Rt<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<&Rt<Slot<Gc<ObjectType<'_>>>>> for usize

Source§

type Error = Error

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

fn try_from(value: &Rt<Slot<Gc<ObjectType<'_>>>>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl From<&Rt<Slot<Gc<ObjectType<'_>>>>> for Option<()>

Source§

fn from(value: &Rt<Slot<Gc<ObjectType<'_>>>>) -> Self

Converts to this type from the input type.
Source§

impl<T: Debug> Debug for Rt<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T: Display> Display for Rt<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T, U> Deref for Rt<(T, U)>

Source§

type Target = (Rt<T>, Rt<U>)

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<T> Deref for Rt<Option<T>>

Source§

type Target = Option<Rt<T>>

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<T: RootedDeref> Deref for Rt<T>

Source§

type Target = <T as RootedDeref>::Target

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<T> Deref for Rt<Vec<T>>

Source§

type Target = [Rt<T>]

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<T, U> DerefMut for Rt<(T, U)>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T: RootedDeref> DerefMut for Rt<T>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> DerefMut for Rt<Vec<T>>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T, I, const N: usize> Index<I> for Rt<[T; N]>
where [Rt<T>]: Index<I>,

Source§

type Output = <[Rt<T>] as Index<I>>::Output

The returned type after indexing.
Source§

fn index(&self, index: I) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T, I: SliceIndex<[Rt<T>]>> Index<I> for Rt<Vec<T>>

Source§

type Output = <I as SliceIndex<[Rt<T>]>>::Output

The returned type after indexing.
Source§

fn index(&self, index: I) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T, I, const N: usize> IndexMut<I> for Rt<[T; N]>
where [Rt<T>]: IndexMut<I>,

Source§

fn index_mut(&mut self, index: I) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T, I: SliceIndex<[Rt<T>]>> IndexMut<I> for Rt<Vec<T>>

Source§

fn index_mut(&mut self, index: I) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T: Eq + ?Sized> Eq for Rt<T>

Source§

impl<T: ?Sized> StructuralPartialEq for Rt<T>

Auto Trait Implementations§

§

impl<T> Freeze for Rt<T>
where T: Freeze + ?Sized,

§

impl<T> RefUnwindSafe for Rt<T>
where T: RefUnwindSafe + ?Sized,

§

impl<T> Send for Rt<T>
where T: Send + ?Sized,

§

impl<T> Sync for Rt<T>
where T: Sync + ?Sized,

§

impl<T> !Unpin for Rt<T>

§

impl<T> UnwindSafe for Rt<T>
where T: UnwindSafe + ?Sized,

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.
§

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

§

fn vzip(self) -> V

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.