pub trait ValueDefault:
Send
+ Sync
+ NonLocalValue
+ ValueDebug {
// Required method
fn value_default() -> Vc<Self>
where Self: Sized;
}Expand description
Vc<T> analog to the Default trait.
Implementing this trait on T will make Vc::default() produce
T::value_default().
There are two ways to implement this trait:
- Annotating with
#[turbo_tasks::value_impl]: this will makeVc::default()always return the same underlying value (i.e. a singleton). - No annotations: this will make
Vc::default()always return a different value.
Required Methods§
fn value_default() -> Vc<Self>where
Self: Sized,
Trait Implementations§
Source§impl VcValueTrait for Box<dyn ValueDefault>
impl VcValueTrait for Box<dyn ValueDefault>
Source§const IMPL_VTABLES: &'static VTableRegistry<Self::ValueTrait>
const IMPL_VTABLES: &'static VTableRegistry<Self::ValueTrait>
The per-trait vtable registry, populated by [crate::value_type::register_all_trait_methods] Read more
type ValueTrait = dyn ValueDefault
Source§fn get_trait_type_id() -> TraitTypeId
fn get_trait_type_id() -> TraitTypeId
Returns the type id of the trait object.
impl Dynamic<Box<dyn ValueDebug>> for Box<dyn ValueDefault>
Available on debug-assertions enabled only.
impl Dynamic<Box<dyn ValueDefault>> for Box<dyn ValueDefault>
impl Upcast<Box<dyn ValueDebug>> for Box<dyn ValueDefault>
Available on debug-assertions enabled only.
impl Upcast<Box<dyn ValueDefault>> for Box<dyn ValueDefault>
impl UpcastStrict<Box<dyn ValueDebug>> for Box<dyn ValueDefault>
Available on debug-assertions enabled only.