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
//! Error type returned while resolving a manifest resource into a
//! container specification.
/// Shorthand alias for `std::result::Result<T, SpecError>`.
///
/// All fallible operations in this crate return this type.
///
/// # Example
///
/// ```rust
/// use lightshuttle_spec::{Result, SpecError};
///
/// fn check(ok: bool) -> Result<u32> {
/// if ok {
/// Ok(42)
/// } else {
/// Err(SpecError::InvalidSpec("something went wrong".into()))
/// }
/// }
///
/// assert!(check(true).is_ok());
/// assert!(check(false).is_err());
/// ```
pub type Result<T> = Result;
/// Errors raised while building a [`crate::ContainerSpec`] from a
/// manifest resource declaration.
///
/// All variants carry a human-readable description of what is invalid
/// so callers can surface a clear diagnostic to the user.
///
/// # Example
///
/// ```rust
/// use lightshuttle_spec::SpecError;
///
/// let err = SpecError::InvalidSpec("port 99999 out of range".into());
/// assert!(err.to_string().contains("invalid container spec"));
/// ```