chiark / gitweb /
use queue
[hippotat.git] / src / prelude.rs
1 // Copyright 2021 Ian Jackson and contributors to Hippotat
2 // SPDX-License-Identifier: GPL-3.0-or-later
3 // There is NO WARRANTY.
4
5 pub use std::array;
6 pub use std::collections::{BTreeSet, HashMap, VecDeque};
7 pub use std::convert::{TryFrom, TryInto};
8 pub use std::borrow::Cow;
9 pub use std::cmp::{min, max};
10 pub use std::fs;
11 pub use std::fmt::{self, Debug, Display, Write as _};
12 pub use std::future::Future;
13 pub use std::io::{self, Cursor, ErrorKind, Read as _, Write as _};
14 pub use std::iter;
15 pub use std::mem;
16 pub use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
17 pub use std::path::{Path, PathBuf};
18 pub use std::panic;
19 pub use std::process;
20 pub use std::pin::Pin;
21 pub use std::str::{self, FromStr};
22 pub use std::sync::Arc;
23 pub use std::task::Poll;
24 pub use std::time::{SystemTime, UNIX_EPOCH};
25
26 pub use anyhow::{anyhow, Context};
27 pub use extend::ext;
28 pub use fehler::{throw, throws};
29 pub use futures::{poll, future};
30 pub use hyper::body::{Bytes, Buf as _};
31 pub use hyper::Uri;
32 pub use hyper_tls::HttpsConnector;
33 pub use ipnet::IpNet;
34 pub use itertools::{iproduct, Itertools};
35 pub use lazy_regex::{regex_is_match, regex_replace_all};
36 pub use log::{trace, debug, info, warn, error};
37 pub use structopt::StructOpt;
38 pub use thiserror::Error;
39 pub use tokio::io::AsyncBufReadExt;
40 pub use tokio::pin;
41 pub use tokio::select;
42 pub use tokio::task;
43 pub use tokio::time::Duration;
44 pub use void::{self, Void, ResultVoidExt, ResultVoidErrExt};
45
46 pub use crate::config::{self, InstanceConfig, u32Ext as _};
47 pub use crate::utils::*;
48 pub use crate::queue::*;
49 pub use crate::reporter::*;
50 pub use crate::types::*;
51 pub use crate::slip::*;
52
53 pub type ReqNum = u64;
54
55 pub use anyhow::Error as AE;
56 pub use ErrorKind as EK;
57 pub use PacketError as PE;
58
59 pub const SLIP_END:     u8 = 0o300; // c0
60 pub const SLIP_ESC:     u8 = 0o333; // db
61 pub const SLIP_ESC_END: u8 = 0o334; // dc
62 pub const SLIP_ESC_ESC: u8 = 0o335; // dd
63 pub const SLIP_MIME_ESC: u8 = b'-'; // 2d
64
65 pub use base64::STANDARD as BASE64_CONFIG;
66
67 pub fn default<T:Default>() -> T { Default::default() }