From: Ian Jackson Date: Thu, 25 Mar 2021 00:00:54 +0000 (+0000) Subject: base: Introduce a prelude module here X-Git-Tag: otter-0.5.0~436 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=d7059c8c0db133d98e2a2f371bfae55423ff4bc6;p=otter.git base: Introduce a prelude module here Signed-off-by: Ian Jackson --- 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 ----------