fn prefix(text: &str, max_bytes: usize) -> &str { &text[..max_bytes.min(text.len())] } fn main() { println!("{}", prefix("用户", 4)); }