improve memory-usage output w/ more byte-sizes

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-01-01 23:49:08 +00:00
committed by strawberry
parent 33635e11d1
commit b8f8f68634
5 changed files with 92 additions and 31 deletions
+10
View File
@@ -5,6 +5,7 @@ use std::{
};
use arrayvec::ArrayString;
use conduwuit::utils::math::Expected;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum FedDest {
@@ -76,6 +77,15 @@ impl FedDest {
pub fn default_port() -> PortString {
PortString::from(DEFAULT_PORT).expect("default port string")
}
#[inline]
#[must_use]
pub fn size(&self) -> usize {
match self {
| Self::Literal(saddr) => size_of_val(saddr),
| Self::Named(host, port) => host.len().expected_add(port.capacity()),
}
}
}
impl fmt::Display for FedDest {