use alloc::{fmt, vec::Vec};
use binary_sv2::{self, Deserialize, Serialize, Str0255};
use core::convert::TryInto;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Reconnect<'decoder> {
pub new_host: Str0255<'decoder>,
pub new_port: u16,
}
impl fmt::Display for Reconnect<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"Reconnect(new_host: {}, new_port: {})",
self.new_host.as_utf8_or_hex(),
self.new_port
)
}
}
impl PartialEq for Reconnect<'_> {
fn eq(&self, other: &Self) -> bool {
self.new_host.as_ref() == other.new_host.as_ref() && self.new_port == other.new_port
}
}