Struct ValueType

Source
pub struct ValueType {
    pub name: String,
    pub traits: AutoSet<TraitTypeId>,
    pub trait_methods: AutoMap<(TraitTypeId, Cow<'static, str>), FunctionId>,
    /* private fields */
}
Expand description

A definition of a type of data.

Contains a list of traits and trait methods that are available on that type.

Fields§

§name: String

A readable name of the type

§traits: AutoSet<TraitTypeId>

List of traits available

§trait_methods: AutoMap<(TraitTypeId, Cow<'static, str>), FunctionId>

List of trait methods available

Implementations§

Source§

impl ValueType

Source

pub fn new<T: VcValueType>() -> Self

This is internally used by #[turbo_tasks::value]

Source

pub fn new_with_magic_serialization<T: VcValueType + Debug + Eq + Hash + Serialize + for<'de> Deserialize<'de> + TraceRawVcs>() -> Self

This is internally used by #[turbo_tasks::value]

Source

pub fn new_with_any_serialization<T: VcValueType + Any + Serialize + for<'de> Deserialize<'de>>() -> Self

This is internally used by #[turbo_tasks::value]

Source

pub fn magic_as_serializable<'a>( &self, arc: &'a Arc<dyn MagicAny>, ) -> Option<&'a dyn Serialize>

Source

pub fn any_as_serializable<'a>( &self, arc: &'a Arc<dyn Any + Sync + Send>, ) -> Option<&'a dyn Serialize>

Source

pub fn is_serializable(&self) -> bool

Source

pub fn get_magic_deserialize_seed(&self) -> Option<MagicAnyDeserializeSeed>

Source

pub fn get_any_deserialize_seed(&self) -> Option<AnyDeserializeSeed>

Source

pub fn register_trait_method( &mut self, trait_type: TraitTypeId, name: Cow<'static, str>, native_fn: FunctionId, )

This is internally used by #[turbo_tasks::value_impl]

Source

pub fn get_trait_method( &self, trait_method_key: &(TraitTypeId, Cow<'static, str>), ) -> Option<&FunctionId>

Source

pub fn register_trait(&mut self, trait_type: TraitTypeId)

This is internally used by #[turbo_tasks::value_impl]

Source

pub fn has_trait(&self, trait_type: &TraitTypeId) -> bool

Source

pub fn traits_iter(&self) -> impl Iterator<Item = TraitTypeId> + '_

Source

pub fn register(&'static self, global_name: &'static str)

Trait Implementations§

Source§

impl Debug for ValueType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ValueType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ValueType

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ValueType

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for ValueType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for T
where T: Any,

§

fn get_type_id(&self) -> TypeId

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DynamicEqHash for T
where T: Any + PartialEq + Eq + Hash,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn dyn_eq(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn dyn_hash(&self, state: &mut dyn Hasher)

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more