MCPcopy Create free account
hub / github.com/GCWing/BitFun / limit_text_len

Function limit_text_len

src/apps/desktop/src/api/skill_api.rs:1372–1380  ·  view source on GitHub ↗
(text: &str, max_len: usize)

Source from the content-addressed store, hash-verified

1370}
1371
1372fn limit_text_len(text: &str, max_len: usize) -> String {
1373 if text.chars().count() <= max_len {
1374 return text.to_string();
1375 }
1376
1377 let mut truncated: String = text.chars().take(max_len).collect();
1378 truncated.push_str("...");
1379 truncated
1380}

Callers 1

Calls 4

collectMethod · 0.80
takeMethod · 0.80
countMethod · 0.45
push_strMethod · 0.45

Tested by

no test coverage detected