diff options
Diffstat (limited to 'tvix/store/src/composition.rs')
-rw-r--r-- | tvix/store/src/composition.rs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/tvix/store/src/composition.rs b/tvix/store/src/composition.rs index a32f22cf7796..063236136fd1 100644 --- a/tvix/store/src/composition.rs +++ b/tvix/store/src/composition.rs @@ -1,17 +1,16 @@ -use lazy_static::lazy_static; +use std::sync::LazyLock; pub use tvix_castore::composition::*; -lazy_static! { - /// The provided registry of tvix_store, which has all the builtin - /// tvix_castore (BlobStore/DirectoryStore) and tvix_store - /// (PathInfoService) implementations. - pub static ref REG: Registry = { - let mut reg = Default::default(); - add_default_services(&mut reg); - reg - }; -} +/// The provided registry of tvix_store, which has all the builtin +/// tvix_castore (BlobStore/DirectoryStore) and tvix_store +/// (PathInfoService) implementations. +pub static REG: LazyLock<&'static Registry> = LazyLock::new(|| { + let mut reg = Default::default(); + add_default_services(&mut reg); + // explicitly leak to get an &'static, so that we gain `&Registry: Send` from `Registry: Sync` + Box::leak(Box::new(reg)) +}); /// Register the builtin services of tvix_castore and tvix_store with the given /// registry. This is useful for creating your own registry with the builtin |