use std::time::Duration;
use tokio_util::bytes::Bytes;
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
pub struct GracefulDisconnectionCount(u64);
impl GracefulDisconnectionCount {
pub fn new(v: u64) -> Self {
Self(v)
}
pub fn as_raw(&self) -> u64 {
self.0
}
}
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
pub struct UngracefulDisconnectionCount(u64);
impl UngracefulDisconnectionCount {
pub fn new(v: u64) -> Self {
Self(v)
}
pub fn as_raw(&self) -> u64 {
self.0
}
}
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
pub struct LastConnectedDuration(u64);
impl LastConnectedDuration {
pub fn new(v: Duration) -> Self {
Self(v.as_secs())
}
pub fn as_seconds(&self) -> u64 {
self.0
}
}
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
#[derive(Debug, PartialEq, Clone)]
pub struct ReconnectionData(
#[cfg_attr(test, proptest(strategy = "crate::tests::arbitrary_bytes()"))] Bytes,
);
impl ReconnectionData {
pub(crate) fn new(bytes: Bytes) -> Self {
Self(bytes)
}
pub(crate) fn as_bytes(&self) -> &Bytes {
&self.0
}
}