intermodal/src/common.rs

96 lines
3.2 KiB
Rust
Raw Normal View History

2019-05-24 10:25:55 +02:00
// stdlib types
pub(crate) use std::{
borrow::Cow,
char,
cmp::{Ordering, Reverse},
collections::{BTreeMap, BTreeSet, HashMap, HashSet},
convert::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, Sub, SubAssign},
path::{self, Path, PathBuf},
process::{self, ExitStatus},
str::{self, FromStr},
sync::Once,
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};
pub(crate) use indicatif::{ProgressBar, ProgressStyle};
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, StructOpt};
pub(crate) use strum::VariantNames;
pub(crate) use strum_macros::{EnumString, EnumVariantNames, IntoStaticStr};
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;
// logging functions
#[allow(unused_imports)]
pub(crate) use log::trace;
2019-05-24 10:25:55 +02:00
// modules
pub(crate) use crate::{consts, error, host_port_parse_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, print::Print, reckoner::Reckoner, step::Step,
};
2019-05-24 10:25:55 +02:00
// structs and enums
pub(crate) use crate::{
arguments::Arguments, bytes::Bytes, env::Env, error::Error, file_error::FileError,
file_info::FileInfo, file_path::FilePath, file_status::FileStatus, files::Files, hasher::Hasher,
host_port::HostPort, host_port_parse_error::HostPortParseError, info::Info, infohash::Infohash,
input::Input, input_target::InputTarget, lint::Lint, linter::Linter, magnet_link::MagnetLink,
md5_digest::Md5Digest, metainfo::Metainfo, metainfo_error::MetainfoError, mode::Mode,
options::Options, output_stream::OutputStream, output_target::OutputTarget,
piece_length_picker::PieceLengthPicker, piece_list::PieceList, platform::Platform,
sha1_digest::Sha1Digest, sort_key::SortKey, sort_order::SortOrder, sort_spec::SortSpec,
status::Status, style::Style, subcommand::Subcommand, table::Table,
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},
process::Command,
rc::Rc,
};
// 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::*;