1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//! Instructions of components including [client], [profile], [request], [response], [task], [utils].
//!
//! # OverView
//!
//! `client` contains some methods to execute `Request` as Future;
//!
//! `utils` is a collection of useful tools like [hash] get now time stamp [now] and other stuff;
//!
//! the others, as the file name suggests, serve as component in integration
//!
//! [hash]: crate::component::utils::hash
//! [now]: crate::component::utils::now
//! [client]: crate::component::client
//! [profile]: crate::component::profile
//! [request]: crate::component::request
//! [response]: crate::component::response
//! [task]: crate::component::task
//! [utils]: crate::component::utils
//!
pub mod client;
pub mod profile;
pub mod request;
pub mod response;
pub mod task;
pub mod utils;

#[doc(hidden)]
pub use client::Client;
#[doc(hidden)]
pub use profile::Profile;
#[doc(hidden)]
pub use request::Request;
#[doc(hidden)]
pub use response::{ParseResult, Response};
#[doc(hidden)]
pub use task::Task;
#[doc(hidden)]
pub use utils::get_cookie;

use std::error::Error;
use std::fmt::Debug;

#[derive(Debug)]
pub struct ProfileError {
    pub desc: String,
}
impl std::fmt::Display for ProfileError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "Profile Error.")
    }
}
impl Error for ProfileError {}

#[derive(Debug)]
pub struct ParseError {
    pub desc: String,
}
impl std::fmt::Display for ParseError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "Parse Error.")
    }
}
impl Error for ParseError {}

#[derive(Debug)]
pub struct ReqError {
    pub desc: String,
}
impl std::fmt::Display for ReqError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "Request Error")
    }
}
impl Error for ReqError {}

#[derive(Debug)]
pub struct ResError {
    pub desc: String,
}
impl std::fmt::Display for ResError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "Response Error.")
    }
}
impl Error for ResError {}
unsafe impl Send for ResError {}
unsafe impl Sync for ResError {}

#[derive(Debug)]
pub struct TaskError {
    pub desc: String,
}
impl std::fmt::Display for TaskError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "Task Error.")
    }
}
impl Error for TaskError {}