intermodal/src/common.rs

87 lines
2.6 KiB
Rust
Raw Normal View History

2019-05-24 10:25:55 +02:00
// stdlib types
pub(crate) use std::{
borrow::Cow,
cmp::Reverse,
collections::{BTreeMap, BTreeSet, HashMap},
convert::{Infallible, TryInto},
2019-05-24 10:25:55 +02:00
env,
ffi::{OsStr, OsString},
fmt::{self, Display, Formatter},
fs::{self, File},
hash::Hash,
io::{self, Read, Write},
iter::{self, Sum},
num::{ParseFloatError, ParseIntError, TryFromIntError},
ops::{AddAssign, Div, DivAssign, Mul, MulAssign, SubAssign},
path::{self, Path, PathBuf},
process::{self, Command, ExitStatus},
str::{self, FromStr},
2019-05-24 10:25:55 +02:00
time::{SystemTime, SystemTimeError},
usize,
2019-05-24 10:25:55 +02:00
};
// dependencies
pub(crate) use bendy::{decoding::FromBencode, encoding::ToBencode, value::Value};
pub(crate) use chrono::{TimeZone, Utc};
pub(crate) use globset::{Glob, GlobMatcher};
2019-05-24 10:25:55 +02:00
pub(crate) use libc::EXIT_FAILURE;
pub(crate) use regex::{Regex, RegexSet};
pub(crate) use serde::{de::Error as _, Deserialize, Deserializer, Serialize, Serializer};
pub(crate) use serde_hex::SerHex;
pub(crate) use serde_with::rust::unwrap_or_skip;
2019-05-24 10:25:55 +02:00
pub(crate) use sha1::Sha1;
pub(crate) use snafu::{ResultExt, Snafu};
pub(crate) use static_assertions::const_assert;
pub(crate) use structopt::{
clap::{AppSettings, ArgSettings},
StructOpt,
};
pub(crate) use unicode_width::UnicodeWidthStr;
pub(crate) use url::{Host, Url};
2019-05-24 10:25:55 +02:00
pub(crate) use walkdir::WalkDir;
// modules
pub(crate) use crate::{consts, error};
2019-05-24 10:25:55 +02:00
// traits
pub(crate) use crate::{
into_u64::IntoU64, into_usize::IntoUsize, path_ext::PathExt,
platform_interface::PlatformInterface, reckoner::Reckoner,
};
2019-05-24 10:25:55 +02:00
// structs and enums
pub(crate) use crate::{
arguments::Arguments, bytes::Bytes, env::Env, error::Error, file_info::FileInfo,
file_path::FilePath, file_status::FileStatus, files::Files, hasher::Hasher, info::Info,
lint::Lint, linter::Linter, md5_digest::Md5Digest, metainfo::Metainfo, mode::Mode, node::Node,
options::Options, piece_length_picker::PieceLengthPicker, piece_list::PieceList,
platform::Platform, sha1_digest::Sha1Digest, status::Status, style::Style,
subcommand::Subcommand, table::Table, target::Target, torrent_summary::TorrentSummary,
use_color::UseColor, verifier::Verifier, walker::Walker,
2019-05-24 10:25:55 +02:00
};
// type aliases
pub(crate) type Result<T, E = Error> = std::result::Result<T, E>;
#[cfg(test)]
mod test {
// test stdlib types
pub(crate) use std::{
cell::RefCell,
io::Cursor,
ops::{Deref, DerefMut},
rc::Rc,
time::{Duration, Instant},
};
// test dependencies
pub(crate) use tempfile::TempDir;
pub(crate) use temptree::temptree;
// test structs and enums
pub(crate) use crate::{capture::Capture, test_env::TestEnv, test_env_builder::TestEnvBuilder};
}
#[cfg(test)]
pub(crate) use test::*;