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
use std::{
    fmt::{self, Display, Formatter},
    ops::Deref,
};

use crate::Addr;

/// Remote peer's address.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RemoteAddr(pub Addr);

impl Deref for RemoteAddr {
    type Target = Addr;

    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

impl Display for RemoteAddr {
    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
        self.0.fmt(f)
    }
}

/// Local server's address.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct LocalAddr(pub Addr);

impl Deref for LocalAddr {
    type Target = Addr;

    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

impl Display for LocalAddr {
    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
        self.0.fmt(f)
    }
}