turbo_tasks/vc/default.rs
1use turbo_tasks::Vc;
2
3use crate::{self as turbo_tasks};
4
5/// `Vc<T>` analog to the `Default` trait.
6///
7/// Implementing this trait on `T` will make `Vc::default()` produce
8/// `T::value_default()`.
9///
10/// There are two ways to implement this trait:
11/// 1. Annotating with `#[turbo_tasks::value_impl]`: this will make `Vc::default()` always return
12/// the same underlying value (i.e. a singleton).
13/// 2. No annotations: this will make `Vc::default()` always return a different value.
14#[turbo_tasks::value_trait]
15pub trait ValueDefault {
16 fn value_default() -> Vc<Self>;
17}