From d7059c8c0db133d98e2a2f371bfae55423ff4bc6 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 25 Mar 2021 00:00:54 +0000 Subject: [PATCH] base: Introduce a prelude module here Signed-off-by: Ian Jackson --- base/lib.rs | 1 + base/prelude.rs | 21 +++++++++++++++++++++ base/zcoord.rs | 18 +----------------- 3 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 base/prelude.rs diff --git a/base/lib.rs b/base/lib.rs index e1b58a16..753b5ce3 100644 --- a/base/lib.rs +++ b/base/lib.rs @@ -3,6 +3,7 @@ // There is NO WARRANTY. pub mod imports; +pub mod prelude; pub mod zcoord; pub mod misc; diff --git a/base/prelude.rs b/base/prelude.rs new file mode 100644 index 00000000..4e1b8e5b --- /dev/null +++ b/base/prelude.rs @@ -0,0 +1,21 @@ +// Copyright 2020-2021 Ian Jackson and contributors to Otter +// SPDX-License-Identifier: AGPL-3.0-or-later +// There is NO WARRANTY. + +pub use std::cmp::{max, Ordering}; +pub use std::convert::{TryFrom, TryInto}; +pub use std::fmt::{self, Debug, Display, Formatter}; +pub use std::hash::{Hash, Hasher}; +pub use std::iter; +pub use std::num::{TryFromIntError, Wrapping}; +pub use std::str; +pub use std::str::FromStr; + +pub use derive_more::*; +pub use fehler::{throw, throws}; +pub use serde::{Deserialize, Serialize}; +pub use serde_with::DeserializeFromStr; +pub use serde_with::SerializeDisplay; +pub use thiserror::Error; + +pub use crate::misc::default; diff --git a/base/zcoord.rs b/base/zcoord.rs index 1c5f34ee..44e9ae5d 100644 --- a/base/zcoord.rs +++ b/base/zcoord.rs @@ -67,23 +67,7 @@ // in the same order as the provided offset multipliers. // The function is deterministic -use std::cmp::{max, Ordering}; -use std::convert::{TryFrom, TryInto}; -use std::fmt::{self, Debug, Display, Formatter}; -use std::hash::{Hash, Hasher}; -use std::iter; -use std::num::{TryFromIntError, Wrapping}; -use std::str; -use std::str::FromStr; - -use derive_more::*; -use fehler::{throw, throws}; -use serde::{Deserialize, Serialize}; -use serde_with::DeserializeFromStr; -use serde_with::SerializeDisplay; -use thiserror::Error; - -use crate::misc::default; +use crate::prelude::*; //---------- core definitions ---------- -- 2.30.2