mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
improve memory-usage output w/ more byte-sizes
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user