pub struct ValueType {
pub ty: RegistryType,
pub persistence: ValueTypePersistence,
pub evictability: Evictability,
/* 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§
§ty: RegistryType§persistence: ValueTypePersistenceHow cells of this type participate in the persistent cache.
evictability: EvictabilityWhether cells of this type can be dropped from in-memory storage on
the eviction sweep. Independent of ValueType::persistence.
Implementations§
Source§impl ValueType
impl ValueType
Sourcepub const fn new<T: VcValueType>(
global_name: &'static str,
persistence: ValueTypePersistence,
evictability: Evictability,
) -> Self
pub const fn new<T: VcValueType>( global_name: &'static str, persistence: ValueTypePersistence, evictability: Evictability, ) -> Self
Construct a ValueType for a non-codec persistence mode
(ValueTypePersistence::Skip / ValueTypePersistence::HashOnly).
Used by #[turbo_tasks::value] for serialization = "skip" and serialization = "hash". For serialization = "auto" | "custom" use ValueType::persistable instead — its codec functions
inline at the call site.
Sourcepub const fn persistable<T: VcValueType + Encode + Decode<()>>(
global_name: &'static str,
evictability: Evictability,
) -> Self
pub const fn persistable<T: VcValueType + Encode + Decode<()>>( global_name: &'static str, evictability: Evictability, ) -> Self
Construct a ValueType whose cells round-trip through the persistent
cache via the auto-derived bincode Encode / Decode impls.
This is internally used by #[turbo_tasks::value] for
serialization = "auto" and serialization = "custom".
Sourcepub const fn new_with_bincode_wrappers<T: VcValueType, E: ManualEncodeWrapper<Value = T>, D: ManualDecodeWrapper<Value = T>>(
global_name: &'static str,
evictability: Evictability,
) -> Self
pub const fn new_with_bincode_wrappers<T: VcValueType, E: ManualEncodeWrapper<Value = T>, D: ManualDecodeWrapper<Value = T>>( global_name: &'static str, evictability: Evictability, ) -> Self
This is used internally by turbo_tasks_macros::primitive to encode/decode foreign types
that cannot implement the bincode traits due to the orphan rules.
This is done by constructing wrapper types that implement the bincode traits on behalf of the wrapped type.
Sourcepub fn type_id(&self) -> TypeId
pub fn type_id(&self) -> TypeId
Returns the TypeId of the concrete type this ValueType represents.
pub fn get_trait_method( &self, trait_method: &'static TraitMethod, ) -> Option<&'static NativeFunction>
pub fn has_trait(&self, trait_type: &TraitTypeId) -> bool
Trait Implementations§
Source§impl Ord for ValueType
impl Ord for ValueType
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for ValueType
impl PartialOrd for ValueType
impl Collect for &'static ValueType
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 UnsafeUnpin for ValueType
impl !UnwindSafe for ValueType
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> DynPartialEq for T
impl<T> DynPartialEq for T
fn dyn_partial_eq(&self, other: &(dyn Any + 'static)) -> bool
§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
§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
key and return true if they are equal.§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
§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> ⓘ
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> ⓘ
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