This repository has been archived on 2023-09-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
rust-opensmtpd/src/data_structures/address.rs
Rodolphe Bréard a6d4dd21c1 Rewrite the project
The previous project architecture was far too complicated and hard to
maintain. The new one is much more simple. Although procedural macros
are cools, they are a no-go on Rust-OpenSMTPD.

Reports and filter are implemented (except data-line) but untested.
2020-11-25 18:04:16 +01:00

20 lines
454 B
Rust

use std::net::SocketAddr;
use std::path::PathBuf;
#[derive(Debug)]
pub enum Address {
Ip(SocketAddr),
UnixSocket(PathBuf),
}
impl ToString for Address {
fn to_string(&self) -> String {
match self {
Address::Ip(a) => a.to_string(),
Address::UnixSocket(a) => match a.clone().into_os_string().into_string() {
Ok(s) => s,
Err(_) => String::new(),
},
}
}
}