/
lib.rs
122 lines (116 loc) · 3.8 KB
/
lib.rs
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
//! A task scheduling and caching system that is focused on incremental
//! execution.
//!
//! It defines 4 primitives:
//! - functions: Unit of execution, invalidation and reexecution.
//! - values: Data created, stored and returned by functions.
//! - traits: Traits that define a set of functions on values.
//! - collectibles: Values emitted in functions that bubble up the call graph
//! and can be collected in parent functions.
//!
//! It also defines some derived elements from that:
//! - cells: The locations in functions where values are stored. The content of
//! a cell can change after the reexecution of a function.
//! - Vcs: A reference to a cell in a function or a return value of a function.
//! - task: An instance of a function together with its arguments.
//!
//! A Vc can be read to get a read-only reference to the stored data.
//!
//! On execution of functions, turbo-tasks will track which Vcs are read. Once
//! any of these change, turbo-tasks will invalidate the task created from the
//! function's execution and it will eventually be scheduled and reexecuted.
//!
//! Collectibles go through a similar process.
#![feature(trivial_bounds)]
#![feature(min_specialization)]
#![feature(try_trait_v2)]
#![feature(hash_extract_if)]
#![deny(unsafe_op_in_unsafe_fn)]
#![feature(result_flattening)]
#![feature(error_generic_member_access)]
#![feature(new_uninit)]
#![feature(arbitrary_self_types)]
#![feature(async_fn_in_trait)]
#![feature(type_alias_impl_trait)]
#![feature(never_type)]
pub mod backend;
mod collectibles;
mod completion;
pub mod debug;
mod display;
pub mod duration_span;
pub mod event;
mod generics;
pub mod graph;
mod id;
mod id_factory;
mod invalidation;
mod join_iter_ext;
#[doc(hidden)]
pub mod macro_helpers;
mod magic_any;
mod manager;
mod native_function;
mod no_move_vec;
mod once_map;
pub mod persisted_graph;
pub mod primitives;
mod raw_vc;
mod raw_vc_set;
mod read_ref;
pub mod registry;
pub mod small_duration;
mod state;
pub mod task;
mod timed_future;
pub mod trace;
mod trait_ref;
pub mod util;
mod value;
mod value_type;
mod vc;
pub use anyhow::{Error, Result};
pub use collectibles::CollectiblesSource;
pub use completion::{Completion, Completions};
pub use display::ValueToString;
pub use id::{
with_task_id_mapping, without_task_id_mapping, FunctionId, IdMapping, TaskId, TraitTypeId,
ValueTypeId,
};
pub use invalidation::{
DynamicEqHash, InvalidationReason, InvalidationReasonKind, InvalidationReasonSet,
};
pub use join_iter_ext::{JoinIterExt, TryFlatJoinIterExt, TryJoinIterExt};
pub use manager::{
dynamic_call, emit, get_invalidator, mark_finished, mark_stateful, run_once,
run_once_with_reason, spawn_blocking, spawn_thread, trait_call, turbo_tasks, Invalidator,
StatsType, TaskIdProvider, TurboTasks, TurboTasksApi, TurboTasksBackendApi, TurboTasksCallApi,
Unused, UpdateInfo,
};
pub use native_function::NativeFunction;
pub use raw_vc::{CellId, CollectiblesFuture, RawVc, ReadRawVcFuture, ResolveTypeError};
pub use read_ref::ReadRef;
pub use state::State;
pub use task::{
concrete_task_input::{ConcreteTaskInput, SharedReference, SharedValue},
task_input::TaskInput,
};
pub use trait_ref::{IntoTraitRef, TraitRef};
pub use turbo_tasks_macros::{function, value, value_impl, value_trait, TaskInput};
pub use value::{TransientInstance, TransientValue, Value};
pub use value_type::{TraitMethod, TraitType, ValueType};
pub use vc::{
Dynamic, TypedForInput, Upcast, ValueDefault, Vc, VcCellNewMode, VcCellSharedMode,
VcDefaultRead, VcRead, VcTransparentRead, VcValueTrait, VcValueType,
};
pub mod test_helpers {
pub use super::manager::{current_task_for_testing, with_turbo_tasks_for_testing};
}
pub fn register() {
include!(concat!(env!("OUT_DIR"), "/register.rs"));
}
/// Helper for derive macros
#[doc(hidden)]
mod turbo_tasks {
pub use crate::macro_helpers;
}