File size: 4,372 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
#![allow(internal_features)]
#![feature(proc_macro_diagnostic)]
#![feature(allow_internal_unstable)]
#![feature(box_patterns)]
mod assert_fields;
mod derive;
mod func;
mod function_macro;
mod generic_type_macro;
mod primitive_macro;
mod value_impl_macro;
mod value_macro;
mod value_trait_macro;
extern crate proc_macro;
use proc_macro::TokenStream;
use proc_macro_error::proc_macro_error;
#[proc_macro_derive(TraceRawVcs, attributes(turbo_tasks))]
pub fn derive_trace_raw_vcs_attr(input: TokenStream) -> TokenStream {
derive::derive_trace_raw_vcs(input)
}
#[proc_macro_derive(NonLocalValue, attributes(turbo_tasks))]
pub fn derive_non_local_value_attr(input: TokenStream) -> TokenStream {
derive::derive_non_local_value(input)
}
#[proc_macro_derive(OperationValue, attributes(turbo_tasks))]
pub fn derive_operation_value_attr(input: TokenStream) -> TokenStream {
derive::derive_operation_value(input)
}
#[proc_macro_derive(ValueDebug, attributes(turbo_tasks))]
pub fn derive_value_debug_attr(input: TokenStream) -> TokenStream {
derive::derive_value_debug(input)
}
#[proc_macro_derive(ValueDebugFormat, attributes(turbo_tasks))]
pub fn derive_value_debug_format_attr(input: TokenStream) -> TokenStream {
derive::derive_value_debug_format(input)
}
#[proc_macro_derive(DeterministicHash, attributes(turbo_tasks))]
pub fn derive_deterministic_hash(input: TokenStream) -> TokenStream {
derive::derive_deterministic_hash(input)
}
#[proc_macro_derive(TaskInput, attributes(turbo_tasks))]
pub fn derive_task_input(input: TokenStream) -> TokenStream {
derive::derive_task_input(input)
}
/// <!--
/// Documentation for this macro is available on the re-export:
/// <https://turbopack-rust-docs.vercel.sh/rustdoc/turbo_tasks/derive.KeyValuePair.html>
/// -->
#[proc_macro_derive(KeyValuePair)]
pub fn derive_key_value_pair(input: TokenStream) -> TokenStream {
derive::derive_key_value_pair(input)
}
/// <!--
/// Documentation for this macro is available on the re-export:
/// <https://turbopack-rust-docs.vercel.sh/rustdoc/turbo_tasks/attr.value.html>
/// -->
#[allow_internal_unstable(min_specialization, into_future, trivial_bounds)]
#[proc_macro_error]
#[proc_macro_attribute]
pub fn value(args: TokenStream, input: TokenStream) -> TokenStream {
value_macro::value(args, input)
}
/// <!--
/// Documentation for this macro is available on the re-export:
/// <https://turbopack-rust-docs.vercel.sh/rustdoc/turbo_tasks/attr.value_trait.html>
/// -->
#[allow_internal_unstable(min_specialization, into_future, trivial_bounds)]
#[proc_macro_error]
#[proc_macro_attribute]
pub fn value_trait(args: TokenStream, input: TokenStream) -> TokenStream {
value_trait_macro::value_trait(args, input)
}
#[allow_internal_unstable(min_specialization, into_future, trivial_bounds)]
#[proc_macro_error]
#[proc_macro_attribute]
pub fn function(args: TokenStream, input: TokenStream) -> TokenStream {
function_macro::function(args, input)
}
#[allow_internal_unstable(min_specialization, into_future, trivial_bounds)]
#[proc_macro_error]
#[proc_macro_attribute]
pub fn test_tt(_args: TokenStream, input: TokenStream) -> TokenStream {
derive::derive_value_debug(input)
}
#[allow_internal_unstable(min_specialization, into_future, trivial_bounds)]
#[proc_macro_error]
#[proc_macro_attribute]
pub fn value_impl(args: TokenStream, input: TokenStream) -> TokenStream {
value_impl_macro::value_impl(args, input)
}
#[allow_internal_unstable(min_specialization, into_future, trivial_bounds)]
#[proc_macro_error]
#[proc_macro]
pub fn primitive(input: TokenStream) -> TokenStream {
primitive_macro::primitive(input)
}
/// Registers a value type that is generic over the `Vc` it contains.
///
/// # Example
///
/// ```
/// use crate::generic_type as __turbo_tasks_internal_generic_type;
///
/// __turbo_tasks_internal_generic_type!(<A, B>, GenericType<Vc<A>, Vc<B>>);
///
/// // Now you can do the following, for any `A` and `B` value types:
///
/// let vc: Vc<GenericType<Vc<u32>, Vc<RcStr>>> = Vc::cell(
/// GenericType::new(
/// Vc::cell(42),
/// Vc::cell("hello".to_string())
/// )
/// );
/// ```
#[allow_internal_unstable(min_specialization, into_future, trivial_bounds)]
#[proc_macro_error]
#[proc_macro]
pub fn generic_type(input: TokenStream) -> TokenStream {
generic_type_macro::generic_type(input)
}
|