linera_base/util/traits.rs
1// Copyright (c) Zefchain Labs, Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4/*!
5Utilities for building traits that work in both single-threaded and multi-threaded
6contexts.
7*/
8
9/// A trait that extends `Send` and `Sync` if not compiling for the Web.
10#[cfg(web)]
11pub trait AutoTraits: 'static {}
12#[cfg(web)]
13impl<T: 'static> AutoTraits for T {}
14
15#[cfg(not(web))]
16trait_set::trait_set! {
17 /// A trait that extends `Send` and `Sync` if not compiling for the Web.
18 pub trait AutoTraits = Send + Sync + 'static;
19}