use std::borrow::Cow;
use std::fmt::Display;
use std::str::FromStr;
pub trait Kid: Clone + PartialEq + Display + FromStr {
fn to_kid_string(&self) -> Cow<'_, str>;
}
impl Kid for u64 {
fn to_kid_string(&self) -> Cow<'_, str> {
// u64는 문자열로 변환이 필요하므로 Owned (할당 발생)
Cow::Owned(itoa::Buffer::new().format(*self).to_string())
}
}
impl Kid for String {
fn to_kid_string(&self) -> Cow<'_, str> {
Cow::Borrowed(self)
}
}