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
#![deny(missing_docs, missing_debug_implementations, trivial_casts, trivial_numeric_casts,
unsafe_code, unstable_features, unused_import_braces, unused_qualifications, unused_results)]
#![cfg_attr(test, deny(warnings))]
extern crate reqwest;
extern crate chrono;
#[macro_use]
extern crate error_chain;
extern crate hex as hexx;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate url_serde;
pub use slack::{Slack, SlackLink, SlackUserLink, SlackText, SlackTextContent, SlackTime};
pub use payload::{Parse, Payload, PayloadBuilder};
pub use attachment::{Attachment, AttachmentBuilder, Field, Section};
pub use hex::{HexColor, SlackColor};
pub use error::{Error, Result};
#[macro_use]
mod macros;
mod helper;
mod error;
mod hex;
mod payload;
mod attachment;
mod slack;
pub trait TryInto<T>: Sized {
type Err;
fn try_into(self) -> ::std::result::Result<T, Self::Err>;
}
pub trait TryFrom<T>: Sized {
type Err;
fn try_from(T) -> ::std::result::Result<Self, Self::Err>;
}
impl<T, U> TryInto<U> for T
where
U: TryFrom<T>,
{
type Err = U::Err;
fn try_into(self) -> ::std::result::Result<U, U::Err> {
U::try_from(self)
}
}
impl<'a> TryFrom<&'a str> for reqwest::Url {
type Err = Error;
fn try_from(s: &str) -> ::std::result::Result<Self, Self::Err> {
match s.parse() {
Ok(u) => Ok(u),
Err(e) => Err(e.into()),
}
}
}