Skip to main content

VcRead

Trait VcRead 

Source
pub trait VcRead<T>
where T: VcValueType,
{ type Target; // Required methods fn value_to_target_ref(value: &T) -> &Self::Target; fn value_to_target(value: T) -> Self::Target; fn target_to_value(target: Self::Target) -> T; fn target_to_value_ref(target: &Self::Target) -> &T; fn target_to_value_mut_ref(target: &mut Self::Target) -> &mut T; }
Expand description

Trait that controls crate::Vc’s read representation.

Has two implementations:

This trait must remain sealed within this crate.

Required Associated Types§

Source

type Target

The read target type. This is the type that will be returned when .awaiting a Vc of a value type.

For instance, the target of .awaiting a Vc<Completion> will be a Completion. When using #[turbo_tasks::value(transparent)], the target will be different than the value type.

Required Methods§

Source

fn value_to_target_ref(value: &T) -> &Self::Target

Convert a reference to a value to a reference to the target type.

Source

fn value_to_target(value: T) -> Self::Target

Convert a value to the target type.

Source

fn target_to_value(target: Self::Target) -> T

Convert the target type to the value.

Source

fn target_to_value_ref(target: &Self::Target) -> &T

Convert a reference to a target type to a reference to a value.

Source

fn target_to_value_mut_ref(target: &mut Self::Target) -> &mut T

Convert a mutable reference to a target type to a reference to a value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> VcRead<T> for VcDefaultRead<T>
where T: VcValueType,

Source§

impl<T, Target> VcRead<T> for VcTransparentRead<T, Target>
where T: VcValueType, Target: Any + Send + Sync,

Source§

type Target = Target