aboutsummaryrefslogtreecommitdiff
path: root/examples/generics/printer.rs
blob: 4307c4f6099e1c16c537c6e1a923811782988948 (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
use std::fmt::Display;

use syrette::injectable;

use crate::interfaces::printer::IPrinter;

pub struct Printer {}

#[injectable]
impl Printer
{
    pub fn new() -> Self
    {
        Self {}
    }
}

impl<Printable: Display> IPrinter<Printable> for Printer
{
    fn print(&self, out: Printable)
    {
        println!("{}", out);
    }
}