#[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>
impl<T> Rt<T>
fn inner(&self) -> &T
fn inner_mut(&mut self) -> &mut T
fn inner_ptr(&self) -> *const T
fn inner_mut_ptr(&mut self) -> *mut T
pub(crate) fn bind_ref<'a, 'ob>(
&'a self,
_: &'ob Context<'_>,
) -> &'a <T as WithLifetime<'ob>>::Outwhere
T: WithLifetime<'ob>,
pub(crate) fn bind_mut<'a, 'ob>(
&'a mut self,
_: &'ob Context<'_>,
) -> &'a mut <T as WithLifetime<'ob>>::Outwhere
T: WithLifetime<'ob>,
pub(crate) fn set<U: IntoRoot<T>>(&mut self, item: U)
Source§impl<T> Rt<Slot<T>>
impl<T> Rt<Slot<T>>
pub(crate) fn bind<'ob>(
&self,
_: &'ob Context<'_>,
) -> <T as WithLifetime<'ob>>::Outwhere
T: WithLifetime<'ob> + Copy,
pub(crate) unsafe fn bind_unchecked<'ob>(
&'ob self,
) -> <T as WithLifetime<'ob>>::Outwhere
T: WithLifetime<'ob> + Copy,
pub(crate) fn bind_slice<'brw, 'ob, U>( slice: &'brw [Rt<Slot<Gc<T>>>], _: &'ob Context<'_>, ) -> &'brw [Gc<U>]
Source§impl<T> Rt<Slot<Gc<T>>>
impl<T> Rt<Slot<Gc<T>>>
Source§impl<T> Rt<Slot<Gc<T>>>
impl<T> Rt<Slot<Gc<T>>>
Sourcepub(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,
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
Sourcepub(crate) fn cast<U>(&self) -> &Rt<Slot<Gc<U>>>
pub(crate) fn cast<U>(&self) -> &Rt<Slot<Gc<U>>>
Like Into
, but needed to due no specialization
pub(crate) fn as_cons(&self) -> &Rt<Slot<Gc<&Cons>>>
Source§impl Rt<Slot<&Cons>>
impl Rt<Slot<&Cons>>
pub(crate) fn car<'ob>(&self, cx: &'ob Context<'_>) -> Gc<ObjectType<'ob>>
pub(crate) fn cdr<'ob>(&self, cx: &'ob Context<'_>) -> Gc<ObjectType<'ob>>
Source§impl<T> Rt<Vec<T>>
impl<T> Rt<Vec<T>>
fn as_mut_ref(&mut self) -> &mut Vec<Rt<T>>
pub(crate) fn push<U: IntoRoot<T>>(&mut self, item: U)
pub(crate) fn truncate(&mut self, len: usize)
pub(crate) fn pop(&mut self)
pub(crate) fn swap_remove(&mut self, index: usize)
pub(crate) fn reserve(&mut self, additional: usize)
pub(crate) fn capacity(&self) -> usize
Source§impl<T> Rt<Vec<T>>
impl<T> Rt<Vec<T>>
pub(crate) fn extend_from_slice<U: IntoRoot<T> + Copy>(&mut self, src: &[U])
Source§impl<T: Clone> Rt<Vec<T>>
impl<T: Clone> Rt<Vec<T>>
pub(crate) fn extend_from_within(&mut self, src: impl RangeBounds<usize>)
Source§impl<K, V> Rt<ObjectMap<K, V>>
impl<K, V> Rt<ObjectMap<K, V>>
fn as_ref(&self) -> &IndexMap<K, V>
fn as_mut(&mut self) -> &mut IndexMap<K, V>
pub(crate) fn insert<Kx: IntoRoot<K>, Vx: IntoRoot<V>>(&mut self, k: Kx, v: Vx)
pub(crate) fn get<Q: IntoRoot<K>>(&self, k: Q) -> Option<&Rt<V>>
pub(crate) fn get_mut<Q: IntoRoot<K>>(&mut self, k: Q) -> Option<&mut Rt<V>>
pub(crate) fn remove<Q: IntoRoot<K>>(&mut self, k: Q)
Trait Implementations§
Source§impl IntoObject for &Rt<Slot<Gc<ObjectType<'_>>>>
impl IntoObject for &Rt<Slot<Gc<ObjectType<'_>>>>
Source§impl IntoObject for &mut Rt<Slot<Gc<ObjectType<'_>>>>
impl IntoObject for &mut Rt<Slot<Gc<ObjectType<'_>>>>
Source§impl<T: RootedDeref> Deref for Rt<T>
impl<T: RootedDeref> Deref for Rt<T>
Source§impl<T: RootedDeref> DerefMut for Rt<T>
impl<T: RootedDeref> DerefMut for Rt<T>
impl<T: Eq + ?Sized> Eq for Rt<T>
impl<T: ?Sized> StructuralPartialEq for Rt<T>
Auto Trait Implementations§
impl<T> Freeze for Rt<T>
impl<T> RefUnwindSafe for Rt<T>where
T: RefUnwindSafe + ?Sized,
impl<T> Send for Rt<T>
impl<T> Sync for Rt<T>
impl<T> !Unpin for Rt<T>
impl<T> UnwindSafe for Rt<T>where
T: UnwindSafe + ?Sized,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
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
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.