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