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
use crateError;
use ;
/// Alias of [`core::result::Result<T, E>`] to enable capturing errors as an [`Error`] object.
///
/// # Examples
///
/// ```
/// # use jeebs::error::*;
/// # use jeebs::result::*;
///
/// // Set the return value as `Result<T>` and you can use the `?` propagator to capture and return
/// // any errors. Values have to be captured and returned using `Ok(T)` or the conversion fails.
/// fn parse(value: &str) -> Result<u32> {
/// let result = value.parse::<u32>()?;
/// Ok(result)
/// }
///
/// let expected_value = 42;
/// assert_eq!(expected_value, parse("42").unwrap());
///
/// let expected_error = Error {
/// value: "invalid digit found in string".to_string(),
/// kind: Some("core::num::error::ParseIntError")
/// };
/// assert_eq!(expected_error, parse("foo").unwrap_err());
/// ```
pub type Result<T> = Result;