#[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: TImplementations§
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,
Sourcepub(crate) fn get_inner(&self) -> Twhere
T: Copy,
pub(crate) fn get_inner(&self) -> Twhere
T: Copy,
Get a copy of the inner value without requiring a Context. This is useful when you need to access the value but don’t have a Context available.
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<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>
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<'_>>>>
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.Source§impl<R> Rng for R
impl<R> Rng for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
Return a random value via the
StandardUniform distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Generate a random value in the given range. Read more
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
Return a bool with a probability
p of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
Return a bool with a probability of
numerator/denominator of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Sample a new value, using the given distribution. Read more
Source§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Create an iterator that generates values using the given distribution. Read more
Source§fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
👎Deprecated since 0.9.0: Renamed to
random to avoid conflict with the new gen keyword in Rust 2024.Alias for
Rng::random.Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
👎Deprecated since 0.9.0: Renamed to
random_rangeAlias for
Rng::random_range.Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§type Error = Infallible
type Error = Infallible
The type returned in the event of a RNG error.
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
Return the next random
u32.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
Return the next random
u64.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
Fill
dest entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
Wrap RNG with the
UnwrapMut wrapper.Source§fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
Convert an
RngCore to a RngReadAdapter.