pub struct RawVc(/* private fields */);Expand description
A type-erased representation of Vc.
Type erasure reduces the monomorphization (and therefore binary size and compilation time)
required to support Vc.
This type is heavily used within the Backend trait, but should
otherwise be treated as an internal implementation detail of turbo-tasks.
§Representation
RawVc is one of three logical variants (see RawVcUnpacked) bit-packed
into a single NonZeroU64.
Bit 31 is the discriminator between a local output and a task variant; the
two task variants are then told apart by whether the CellId field (the
high 32 bits) is zero — which is unambiguous because every CellId is
non-zero.
bit31 = 1 LocalOutput: 1<<31 | transient(1) | ExecutionId(16) << 1 | LocalTaskId(32) << 32
bit31 = 0, bits32..63 == 0 TaskOutput: TaskId(31)
bit31 = 0, bits32..63 != 0 TaskCell: TaskId(31) | CellId(32) << 32Implementations§
Source§impl RawVc
impl RawVc
Sourcepub fn task_output(task: TaskId) -> Self
pub fn task_output(task: TaskId) -> Self
Packs the synchronous return value of a task. The word is simply the
TaskId value: bit 31 clear (a task variant) and the cell field zero
(no cell).
Sourcepub fn task_cell(task: TaskId, cell: CellId) -> Self
pub fn task_cell(task: TaskId, cell: CellId) -> Self
Packs a pointer to a specific cell within a task: the TaskId in the low
bits and the non-zero CellId in the high 32 bits.
Sourcepub fn local_output(
execution_id: ExecutionId,
local_task_id: LocalTaskId,
persistence: TaskPersistence,
) -> Self
pub fn local_output( execution_id: ExecutionId, local_task_id: LocalTaskId, persistence: TaskPersistence, ) -> Self
Packs the synchronous return value of a local task, marked by bit 31.
Sourcepub fn unpack(self) -> RawVcUnpacked
pub fn unpack(self) -> RawVcUnpacked
Unpacks into the logical RawVcUnpacked enum for matching.
Sourcepub fn as_task_output(self) -> Option<TaskId>
pub fn as_task_output(self) -> Option<TaskId>
Sourcepub fn as_task_cell(self) -> Option<(TaskId, CellId)>
pub fn as_task_cell(self) -> Option<(TaskId, CellId)>
Returns the (TaskId, CellId) pair if this is a TaskCell, otherwise
None.
Prefer this over unpack when a caller only cares about
the TaskCell case: it reads just the discriminator, the task bits, and
the cell bits.
Sourcepub fn as_local_output(
self,
) -> Option<(ExecutionId, LocalTaskId, TaskPersistence)>
pub fn as_local_output( self, ) -> Option<(ExecutionId, LocalTaskId, TaskPersistence)>
Returns the (ExecutionId, LocalTaskId, TaskPersistence) triple if this
is a LocalOutput, otherwise None.
Prefer this over unpack when a caller only cares about
the LocalOutput case.
Source§impl RawVc
impl RawVc
pub fn is_resolved(&self) -> bool
pub fn is_local_output(&self) -> bool
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Returns true if the task this RawVc reads from cannot be serialized and will not be
stored in the filesystem cache.
See TaskPersistence for more details.
Sourcepub async fn to_non_local(self) -> Result<RawVc>
pub async fn to_non_local(self) -> Result<RawVc>
Convert a potentially local RawVc into a non-local RawVc. This is a subset of resolution
resolution, because the returned RawVc can be a TaskOutput.
pub fn try_get_task_id(&self) -> Option<TaskId>
pub fn try_get_type_id(&self) -> Option<ValueTypeId>
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for RawVc
impl<'__de, __Context> BorrowDecode<'__de, __Context> for RawVc
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl CollectiblesSource for RawVc
This implementation of CollectiblesSource assumes that self is a RawVc::TaskOutput.
impl CollectiblesSource for RawVc
This implementation of CollectiblesSource assumes that self is a RawVc::TaskOutput.
fn peek_collectibles<T: VcValueTrait + ?Sized>(self) -> AutoSet<ResolvedVc<T>>
fn take_collectibles<T: VcValueTrait + ?Sized>(self) -> AutoSet<ResolvedVc<T>>
fn drop_collectibles<T: VcValueTrait + ?Sized>(self)
Source§impl<'de> Deserialize<'de> for RawVc
impl<'de> Deserialize<'de> for RawVc
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<CurrentCellRef> for RawVc
impl From<CurrentCellRef> for RawVc
Source§fn from(cell: CurrentCellRef) -> Self
fn from(cell: CurrentCellRef) -> Self
Source§impl TraceRawVcs for RawVc
impl TraceRawVcs for RawVc
fn trace_raw_vcs(&self, trace_context: &mut TraceRawVcsContext)
fn get_raw_vcs(&self) -> Vec<RawVc>
impl Copy for RawVc
impl Eq for RawVc
impl StructuralPartialEq for RawVc
Auto Trait Implementations§
impl Freeze for RawVc
impl RefUnwindSafe for RawVc
impl Send for RawVc
impl Sync for RawVc
impl Unpin for RawVc
impl UnsafeUnpin for RawVc
impl UnwindSafe for RawVc
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DynPartialEq for T
impl<T> DynPartialEq for T
fn dyn_partial_eq(&self, other: &(dyn Any + 'static)) -> bool
Source§impl<T> DynTaskInputs for T
impl<T> DynTaskInputs for T
fn dyn_type_name(&self) -> &'static str
§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
§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
key and return true if they are equal.§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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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