Skip to main content

ValueDefault

Trait ValueDefault 

Source
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:

  1. Annotating with #[turbo_tasks::value_impl]: this will make Vc::default() always return the same underlying value (i.e. a singleton).
  2. No annotations: this will make Vc::default() always return a different value.

Required Methods§

Source

fn value_default() -> Vc<Self>
where Self: Sized,

Trait Implementations§

Source§

impl Dynamic<Box<dyn ValueDebug>> for Box<dyn ValueDefault>

Available on debug-assertions enabled only.
Source§

impl Dynamic<Box<dyn ValueDefault>> for Box<dyn ValueDefault>

Source§

impl Upcast<Box<dyn ValueDebug>> for Box<dyn ValueDefault>

Available on debug-assertions enabled only.
Source§

impl Upcast<Box<dyn ValueDefault>> for Box<dyn ValueDefault>

Source§

impl UpcastStrict<Box<dyn ValueDebug>> for Box<dyn ValueDefault>

Available on debug-assertions enabled only.
Source§

impl VcValueTrait for Box<dyn ValueDefault>

Source§

const IMPL_VTABLES: &'static VTableRegistry<Self::ValueTrait>

The per-trait vtable registry, populated by [crate::value_type::register_all_trait_methods] Read more
Source§

type ValueTrait = dyn ValueDefault

Source§

fn get_trait_type_id() -> TraitTypeId

Returns the type id of the trait object.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ValueDefault for ()

Source§

impl ValueDefault for Duration

Source§

impl ValueDefault for Option<RcStr>

Source§

impl ValueDefault for Option<String>

Source§

impl ValueDefault for Option<bool>

Source§

impl ValueDefault for Option<u16>

Source§

impl ValueDefault for Option<u64>

Source§

impl ValueDefault for RcStr

Source§

impl ValueDefault for String

Source§

impl ValueDefault for Value

Source§

impl ValueDefault for Vec<RcStr>

Source§

impl ValueDefault for Vec<bool>

Source§

impl ValueDefault for Vec<u8>

Source§

impl ValueDefault for bool

Source§

impl ValueDefault for i8

Source§

impl ValueDefault for i16

Source§

impl ValueDefault for i32

Source§

impl ValueDefault for i64

Source§

impl ValueDefault for i128

Source§

impl ValueDefault for isize

Source§

impl ValueDefault for u8

Source§

impl ValueDefault for u16

Source§

impl ValueDefault for u32

Source§

impl ValueDefault for u64

Source§

impl ValueDefault for u128

Source§

impl ValueDefault for usize

Implementors§