Skip to main content

GcRoot

Struct GcRoot 

Source
pub struct GcRoot<T: ?Sized> { /* private fields */ }
Expand description

An RAII guard that pins an OperationVc’s task against garbage collection.

Implementations§

Source§

impl<T: ?Sized> GcRoot<T>

Source

pub fn pin(tt: Arc<dyn TurboTasksApi>, vc: OperationVc<T>) -> Self

Pins vc’s task, returning a guard that unpins it on drop.

Trait Implementations§

Source§

impl<T: ?Sized> Borrow<OperationVc<T>> for GcRoot<T>

Lets a collection keyed on guards be queried with the bare operation: Borrow plus the matching Hash/Eq impls give OperationVc<T>: Equivalent<GcRoot<T>>, so e.g. IndexSet<GcRoot<T>>::swap_remove accepts an &OperationVc<T>.

Source§

fn borrow(&self) -> &OperationVc<T>

Immutably borrows from an owned value. Read more
Source§

impl<T: ?Sized> Clone for GcRoot<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: ?Sized> Debug for GcRoot<T>

Source§

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

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

impl<T: ?Sized> Deref for GcRoot<T>

A guard derefs to the operation it pins, so OperationVc’s own methods can be called on it directly and *guard recovers the operation itself.

Source§

type Target = OperationVc<T>

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<T: ?Sized> Drop for GcRoot<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<T: ?Sized> Eq for GcRoot<T>

Source§

impl<T: ?Sized> Hash for GcRoot<T>

Source§

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

Hashes the pinned operation, consistently with PartialEq, so a guard can be looked up in a set by the OperationVc it pins (see the Borrow impl).

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<T: NonLocalValue + ?Sized> NonLocalValue for GcRoot<T>

Safety: mirrors the OperationVc impl — a GcRoot holds no task-local data beyond the operation it pins.

Source§

impl<T: ?Sized + Send> OperationValue for GcRoot<T>

Safety: a GcRoot contains exactly one OperationVc and no Vc or ResolvedVc, which is what OperationValue asserts.

Source§

impl<T: ?Sized> PartialEq for GcRoot<T>

Source§

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

Compares the pinned operation only. Two guards for the same operation are interchangeable as far as reachability is concerned, even though each holds its own pin.

1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<T: ?Sized> TraceRawVcs for GcRoot<T>

Source§

fn trace_raw_vcs(&self, trace_context: &mut TraceRawVcsContext)

Source§

fn get_raw_vcs(&self) -> Vec<RawVc>

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for GcRoot<T>

§

impl<T> !UnwindSafe for GcRoot<T>

§

impl<T> Freeze for GcRoot<T>
where T: ?Sized,

§

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

§

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

§

impl<T> Unpin for GcRoot<T>
where T: Unpin + ?Sized,

§

impl<T> UnsafeUnpin for GcRoot<T>
where T: ?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
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
§

impl<T> DynEq for T
where T: Any + Eq,

§

impl<T> DynHash for T
where T: Any + Hash,

§

fn dyn_hash(&self, state: &mut dyn Hasher)

§

impl<T> DynPartialEq for T
where T: Any + PartialEq,

§

fn dyn_partial_eq(&self, other: &(dyn Any + 'static)) -> bool

Source§

impl<T> DynTaskInputs for T
where T: Debug + Eq + Hash + Send + Sync + TraceRawVcs + 'static,

Source§

fn dyn_type_name(&self) -> &'static str

§

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

impl<T> MaybeTypeTag for T

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> Same for T

Source§

type Output = T

Should always be Self
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.
§

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