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
impl ValueType
Sourcepub fn new<T: VcValueType>() -> Self
pub fn new<T: VcValueType>() -> Self
This is internally used by #[turbo_tasks::value]
Sourcepub fn new_with_magic_serialization<T: VcValueType + Debug + Eq + Hash + Serialize + for<'de> Deserialize<'de> + TraceRawVcs>() -> Self
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]
Sourcepub fn new_with_any_serialization<T: VcValueType + Any + Serialize + for<'de> Deserialize<'de>>() -> Self
pub fn new_with_any_serialization<T: VcValueType + Any + Serialize + for<'de> Deserialize<'de>>() -> Self
This is internally used by #[turbo_tasks::value]
pub fn magic_as_serializable<'a>( &self, arc: &'a Arc<dyn MagicAny>, ) -> Option<&'a dyn Serialize>
pub fn any_as_serializable<'a>( &self, arc: &'a Arc<dyn Any + Sync + Send>, ) -> Option<&'a dyn Serialize>
pub fn is_serializable(&self) -> bool
pub fn get_magic_deserialize_seed(&self) -> Option<MagicAnyDeserializeSeed>
pub fn get_any_deserialize_seed(&self) -> Option<AnyDeserializeSeed>
Sourcepub fn register_trait_method(
&mut self,
trait_type: TraitTypeId,
name: Cow<'static, str>,
native_fn: FunctionId,
)
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]
pub fn get_trait_method( &self, trait_method_key: &(TraitTypeId, Cow<'static, str>), ) -> Option<&FunctionId>
Sourcepub fn register_trait(&mut self, trait_type: TraitTypeId)
pub fn register_trait(&mut self, trait_type: TraitTypeId)
This is internally used by #[turbo_tasks::value_impl]
pub fn has_trait(&self, trait_type: &TraitTypeId) -> bool
pub fn traits_iter(&self) -> impl Iterator<Item = TraitTypeId> + '_
pub fn register(&'static self, global_name: &'static str)
Trait Implementations§
impl Eq for ValueType
Auto Trait Implementations§
impl Freeze for ValueType
impl RefUnwindSafe for ValueType
impl Send for ValueType
impl Sync for ValueType
impl Unpin for ValueType
impl UnwindSafe for ValueType
Blanket Implementations§
§impl<T> Any for Twhere
T: Any,
impl<T> Any for Twhere
T: Any,
fn get_type_id(&self) -> TypeId
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> DynamicEqHash for T
impl<T> DynamicEqHash for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
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
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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