Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Registry

Registration of value types, tait types and functions is required for serialization (Persistent Caching). This is handled by the turbo-tasks-build create.

Required setup in every crate using Turbo-Engine:

// build.rs
use turbo_tasks_build::generate_register;

fn main() {
    generate_register();
}
// src/lib.rs

// ...

pub fn register() {
    // Call register for all dependencies
    turbo_tasks::register();

    // Run the generated registration code for items of the own crate
    include!(concat!(env!("OUT_DIR"), "/register.rs"));
}

In test cases using Turbo Engine:

include!(concat!(env!("OUT_DIR"), "/register_test_<test-case>.rs"));

Why?

During deserialization Turbo Engine need to look up the deserialization code needed from the registry since type information is not statically known.