use serde::{Deserialize, Serialize};
use std::fmt;
use std::fmt::{Display, Formatter};
#[derive(Serialize, Deserialize, Debug)]
pub struct Ipv {
pub address: String, pub port: i64, }
impl Ipv {
pub fn new<S: AsRef<str>>(address: S, port: i64) -> Ipv {
Ipv { address: address.as_ref().to_string(), port }
}
}
impl Display for Ipv {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
write!(f, "地址:{a},端口:{p}", a = self.address, p = self.port)
}
}