af_core/util.rs
1// Copyright © 2020 Alexandra Frydl
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7//! Miscellaneous utilities.
8
9mod defer;
10mod uuid;
11
12pub use self::defer::{defer, Deferred};
13pub use self::uuid::Uuid;
14pub use af_core_macros::{attempt, attempt_async};
15pub use cfg_if::cfg_if;
16pub use futures_lite::pin;
17pub use once_cell::sync::Lazy;
18pub use pin_project::pin_project;
19
20/// Returns the “default value” for a type.
21pub fn default<T: Default>() -> T {
22 T::default()
23}