blob: f615ff53dceb9fc514362834a7bfc74bd1a7c54d (
plain)
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
|
#![deny(clippy::all)]
#![deny(clippy::pedantic)]
#![allow(clippy::module_name_repetitions)]
use std::fmt::Display;
mod bootstrap;
mod interfaces;
mod ninja;
use error_stack::{Context, ResultExt};
use crate::bootstrap::bootstrap;
use crate::interfaces::ninja::INinja;
#[derive(Debug)]
struct ApplicationError;
impl Display for ApplicationError
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
{
f.write_str("An application error has occurred")
}
}
impl Context for ApplicationError {}
fn main() -> error_stack::Result<(), ApplicationError>
{
println!("Hello, world!");
let di_container = bootstrap().change_context(ApplicationError)?;
let ninja = di_container
.get::<dyn INinja>()
.change_context(ApplicationError)?;
ninja.throw_shuriken();
Ok(())
}
|